Skip to content

Commit c3bec5f

Browse files
committed
remove SET statement support
1 parent b9d1ca0 commit c3bec5f

File tree

6 files changed

+4
-53
lines changed

6 files changed

+4
-53
lines changed

client-v2/src/main/java/com/clickhouse/client/api/Client.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,10 +2213,6 @@ public void setDBRoles(Collection<String> dbRoles) {
22132213
this.configuration.get(ClientConfigProperties.SESSION_DB_ROLES.getKey())));
22142214
}
22152215

2216-
public void setProfile(String name) {
2217-
this.configuration.put(ClientConfigProperties.PROFILE.getKey(), name);
2218-
}
2219-
22202216
public void updateClientName(String name) {
22212217
this.configuration.put(ClientConfigProperties.CLIENT_NAME.getKey(), name);
22222218
}

client-v2/src/main/java/com/clickhouse/client/api/ClientConfigProperties.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ public enum ClientConfigProperties {
2222

2323
PASSWORD("password", ""),
2424

25-
PROFILE("profile"),
26-
2725
/**
2826
* Maximum number of active connection in internal connection pool.
2927
*/

client-v2/src/main/java/com/clickhouse/client/api/internal/HttpAPIClientHelper.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -559,12 +559,6 @@ private void addQueryParams(URIBuilder req, Map<String, String> chConfig, Map<St
559559
sessionRoles.forEach(r -> req.addParameter(ClickHouseHttpProto.QPARAM_ROLE, r));
560560
}
561561

562-
String profile = (String) requestConfig.getOrDefault(ClientConfigProperties.PROFILE.getKey(),
563-
chConfiguration.getOrDefault(ClientConfigProperties.PROFILE.getKey(), ""));
564-
if (!profile.isEmpty()) {
565-
req.addParameter(ClientConfigProperties.PROFILE.getKey(), profile);
566-
}
567-
568562
for (String key : requestConfig.keySet()) {
569563
if (key.startsWith(ClientConfigProperties.SERVER_SETTING_PREFIX)) {
570564
Object val = requestConfig.get(key);

jdbc-v2/src/main/java/com/clickhouse/jdbc/StatementImpl.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -373,19 +373,6 @@ public boolean executeImpl(String sql, StatementType type, QuerySettings setting
373373
connection.client.setDBRoles(roles);
374374
}
375375
}
376-
377-
} else if (JdbcUtils.containsIgnoresCase(tokens, "=")){
378-
String key = tokens.get(1);
379-
String value = tokens.get(3).replace("'", "");
380-
//SET profile
381-
if (key.equals("profile")) {
382-
connection.client.setProfile(value);
383-
LOG.debug("Set profile to {}", value);
384-
} else {
385-
//SET session settings
386-
connection.getDefaultQuerySettings().serverSetting(key, value);
387-
LOG.debug("Set session server setting {} to {}", key, value);
388-
}
389376
}
390377
return false;
391378
} else if (type == StatementType.USE) {

jdbc-v2/src/test/java/com/clickhouse/jdbc/DataTypeTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,12 +955,15 @@ public void testNestedTypeSimpleStatement() throws SQLException {
955955

956956
@Test(groups = { "integration" })
957957
public void testNestedTypeNonFlatten() throws SQLException {
958+
if (earlierThan(25,1)){
959+
return;
960+
}
958961
try (Connection conn = getConnection()) {
959962
try (Statement stmt = conn.createStatement()) {
960963
stmt.execute("SET flatten_nested = 0");
961964
stmt.execute("CREATE TABLE test_nested_not_flatten (order Int8, "
962965
+ "nested Nested (int8 Int8, int16 Int16, int32 Int32, int64 Int64, int128 Int128, int256 Int256)"
963-
+ ") ENGINE = MergeTree ORDER BY ()");
966+
+ ") ENGINE = MergeTree ORDER BY () SETTINGS flatten_nested = 0");
964967
// Insert random (valid) values
965968
long seed = System.currentTimeMillis();
966969
Random rand = new Random(seed);

jdbc-v2/src/test/java/com/clickhouse/jdbc/StatementTest.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -412,33 +412,6 @@ record = conn.client.queryAll("SELECT currentRoles()").get(0);
412412
}
413413
}
414414

415-
@Test(groups = { "integration" })
416-
public void testSetStatement() throws SQLException {
417-
try (ConnectionImpl conn = (ConnectionImpl) getJdbcConnection()) {
418-
try (Statement stmt = conn.createStatement()) {
419-
420-
stmt.execute("SET session_timezone = 'Europe/Berlin'");
421-
try (ResultSet rs = stmt.executeQuery("SELECT timezone()")){
422-
assertTrue(rs.next());
423-
assertEquals(rs.getString(1),"Europe/Berlin");
424-
assertFalse(rs.next());
425-
}
426-
stmt.execute("SET network_compression_method = 'GZIP'");
427-
try (ResultSet rs = stmt.executeQuery("SELECT getSetting('network_compression_method')")){
428-
assertTrue(rs.next());
429-
assertEquals(rs.getString(1),"GZIP");
430-
assertFalse(rs.next());
431-
}
432-
stmt.execute("SET profile = 'readonly'");
433-
try (ResultSet rs = stmt.executeQuery("SELECT currentProfiles()")){
434-
assertTrue(rs.next());
435-
assertEquals(((Object[]) rs.getArray(1).getArray())[0],"readonly");
436-
assertFalse(rs.next());
437-
}
438-
}
439-
}
440-
}
441-
442415
@Test
443416
public void testGettingArrays() throws Exception {
444417
try (ConnectionImpl conn = (ConnectionImpl) getJdbcConnection();

0 commit comments

Comments
 (0)