Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 80d7443

Browse files
committed
Support old version of ClickHouse
1 parent 1e94d63 commit 80d7443

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/main/java/ru/yandex/clickhouse/jdbcbridge/core/QueryParser.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public class QueryParser {
3838
// Otherwise NULLs will be substituted with default values.
3939
// Currently supported only for 'mysql' table function.
4040
private static final String PARAM_EXT_TABLE_USE_NULLS = "external_table_functions_use_nulls";
41-
private static final String PARAM_COLUMNS = "sample_block";
41+
private static final String PARAM_COLUMNS = "columns";
42+
private static final String PARAM_SAMPLE_BLOCK = "sample_block";
4243
private static final String PARAM_QUERY = "query";
4344
private static final String PARAM_DB_NAME = "db_name";
4445
private static final String PARAM_TABLE_NAME = "table_name";
@@ -260,8 +261,12 @@ public static QueryParser fromRequest(RoutingContext ctx, Repository<NamedDataSo
260261

261262
String uri = Objects.requireNonNull(resolver).resolve(req.getParam(PARAM_CONNECTION_STRING));
262263
if (forWrite) {
263-
query = new QueryParser(uri, req.getParam(PARAM_DB_NAME), req.getParam(PARAM_TABLE_NAME),
264-
req.getParam(PARAM_COLUMNS), req.getParam(PARAM_FORMAT_NAME), null, null);
264+
String columns = req.getParam(PARAM_SAMPLE_BLOCK);
265+
if (columns == null) {
266+
columns = req.getParam(PARAM_COLUMNS);
267+
}
268+
query = new QueryParser(uri, req.getParam(PARAM_DB_NAME), req.getParam(PARAM_TABLE_NAME), columns,
269+
req.getParam(PARAM_FORMAT_NAME), null, null);
265270
} else {
266271
String schema = req.getParam(PARAM_SCHEMA);
267272
String table = req.getParam(PARAM_TABLE);
@@ -287,7 +292,10 @@ public static QueryParser fromRequest(RoutingContext ctx, Repository<NamedDataSo
287292
}
288293

289294
if (columns == null) {
290-
columns = req.getParam(PARAM_COLUMNS);
295+
columns = req.getParam(PARAM_SAMPLE_BLOCK);
296+
if (columns == null) {
297+
columns = req.getParam(PARAM_COLUMNS);
298+
}
291299
}
292300

293301
if (schema == null) {

0 commit comments

Comments
 (0)