Skip to content

Commit d7fdd63

Browse files
committed
Merge branch 'main' into pre_0.9.7
2 parents fdc72df + ceb9f49 commit d7fdd63

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public <T> T getDefObjVal() {
239239
// Key used to identify default value in configuration map
240240
public static final String DEFAULT_KEY = "_default_";
241241

242-
public static final String NO_THROW_ON_UNKNOWN_CONFIG = "no_throw_on_unknown_config";
242+
public static final String IGNORE_UNKNOWN_CONFIG_KEY = "ignore_unknown_config_key";
243243

244244
public static String serverSetting(String key) {
245245
return SERVER_SETTING_PREFIX + key;
@@ -363,10 +363,10 @@ public static Map<String, Object> parseConfigMap(Map<String, String> configMap)
363363
}
364364
}
365365

366-
tmpMap.remove(ClientConfigProperties.NO_THROW_ON_UNKNOWN_CONFIG);
366+
tmpMap.remove(ClientConfigProperties.IGNORE_UNKNOWN_CONFIG_KEY);
367367
if (!tmpMap.isEmpty()) {
368368
String msg = "Unknown and unmapped config properties: " + tmpMap.keySet();
369-
if (configMap.containsKey(NO_THROW_ON_UNKNOWN_CONFIG)) {
369+
if (Boolean.parseBoolean(String.valueOf(configMap.get(IGNORE_UNKNOWN_CONFIG_KEY)))) {
370370
LOG.warn(msg);
371371
} else {
372372
throw new ClientMisconfigurationException(msg);

client-v2/src/test/java/com/clickhouse/client/ClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ public void testUnknownClientSettings() throws Exception {
502502
Assert.assertTrue(ex.getMessage().contains("unknown_setting"));
503503
}
504504

505-
try (Client client = newClient().setOption(ClientConfigProperties.NO_THROW_ON_UNKNOWN_CONFIG, "what ever").setOption("unknown_setting", "value").build()) {
505+
try (Client client = newClient().setOption(ClientConfigProperties.IGNORE_UNKNOWN_CONFIG_KEY, "true").setOption("unknown_setting", "value").build()) {
506506
Assert.assertTrue(client.ping());
507507
}
508508

jdbc-v2/src/main/javacc/ClickHouseSqlParser.jj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ void columnExpr(): { Token t; } {
831831
| (LOOKAHEAD(2) macro())+
832832
| LOOKAHEAD(2, { !(tokenIn(1, INF, NAN, NULL) && tokenIn(2, DOT)) }) literal()
833833
| LOOKAHEAD(2, { getToken(2).kind == LPAREN }) functionExpr() { token_source.funcUsed = true; }
834-
| anyIdentifier() (LOOKAHEAD(2) <DOT> anyIdentifier())*
834+
| anyIdentifier() (LOOKAHEAD(2) <DOT> (<CARET>)? anyIdentifier())*
835835
}
836836

837837
// interested parts
@@ -930,7 +930,7 @@ Token aliasExpr(): { Token t = null; } {
930930
}
931931

932932
void nestedIdentifier(): {} {
933-
(<ASTERISK> | anyIdentifier()) (LOOKAHEAD(2) <DOT> (<ASTERISK> | anyIdentifier()))*
933+
(<ASTERISK> | anyIdentifier()) (LOOKAHEAD(2) <DOT> (<CARET>)? (<ASTERISK> | anyIdentifier()))*
934934
}
935935

936936
void tableIdentifier(boolean record): { } {
@@ -1029,7 +1029,7 @@ Token numberLiteral(): { Token t = null; StringBuilder sb = new StringBuilder();
10291029
}
10301030

10311031
void operator(): {} {
1032-
(<ARROW> | <ASTERISK> | <CONCAT> | <CONVERT> | <DASH> | <EQ_DOUBLE> | <EQ_SINGLE>
1032+
(<ARROW> | <ASTERISK> | <CARET> | <CONCAT> | <CONVERT> | <DASH> | <EQ_DOUBLE> | <EQ_SINGLE>
10331033
| <GE> | <GT> | <LE> | <LT> | <NOT_EQ> | <PERCENT> | <PLUS> | <SLASH>)
10341034
}
10351035

@@ -1286,6 +1286,7 @@ TOKEN: {
12861286
| <RPAREN: ")">
12871287
| <SEMICOLON: ";">
12881288
| <SLASH: "/">
1289+
| <CARET: "^">
12891290
| <#UNDERSCORE: "_">
12901291
}
12911292

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,6 @@ public void testUnknownSettings() throws Exception {
194194
}
195195

196196
// next should not throw exception
197-
driver.connect(getEndpointString() + "?unknown_setting=1&" + ClientConfigProperties.NO_THROW_ON_UNKNOWN_CONFIG + "=1", new Properties()).close();
197+
driver.connect(getEndpointString() + "?unknown_setting=1&" + ClientConfigProperties.IGNORE_UNKNOWN_CONFIG_KEY + "=true", new Properties()).close();
198198
}
199199
}

jdbc-v2/src/test/java/com/clickhouse/jdbc/internal/BaseSqlParserFacadeTest.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,10 @@ public Object[][] testMiscStmtDp() {
454454
{"select countIf(*, 1 = ?)", 1},
455455
{"select count(*) filter (where 1 = ?)", 1},
456456
{WHEN_HAS_ARRAY, 0},
457+
{EXTEND_JOIN_ALIAS_SYNTAX, 0},
458+
{"SELECT * FROM t WHERE hasToken(message, 'DDLWorker')", 0},
459+
{"SELECT * FROM t WHERE hasAllTokens(message, ['peak', 'memory'])", 0},
460+
{"SELECT * FROM t WHERE hasAnyTokens(message, tokens('01442_merge_detach_attach'))", 0},
457461
};
458462
}
459463

@@ -569,6 +573,11 @@ public Object[][] testMiscStmtDp() {
569573
" END AS action_to_do\n" +
570574
"FROM db.table1";
571575

576+
private static final String EXTEND_JOIN_ALIAS_SYNTAX = "SELECT *\n" +
577+
"FROM (SELECT 1) AS t(a)\n" +
578+
"JOIN (SELECT 1) AS u(b)\n" +
579+
"ON a = b";
580+
572581
@Test(dataProvider = "testStatementWithoutResultSetDP")
573582
public void testStatementsForResultSet(String sql, int args, boolean hasResultSet) {
574583
System.out.println("sql: " + sql);
@@ -652,7 +661,8 @@ public static Object[][] testStatementWithoutResultSetDP() {
652661
{"CHECK GRANT SELECT(col2) ON table_2", 0, true},
653662
{"CHECK TABLE test_table", 0, true},
654663
{"CHECK TABLE t0 PARTITION ID '201003' FORMAT PrettyCompactMonoBlock SETTINGS check_query_single_value_result = 0", 0, true},
655-
664+
{"select toJSONString(data.^header_index) from database.analyzed limit 1;", 0, true},
665+
{"select toJSONString(data.^header_index), ? as text from database.analyzed limit 1;", 1, true},
656666

657667
/* no result set */
658668
{"INSERT INTO test_table VALUES (1, ?)", 1, false},

0 commit comments

Comments
 (0)