From 169ebab55d13e2df77b9a4107ac5590b4a07c850 Mon Sep 17 00:00:00 2001 From: Sergey Chernov Date: Mon, 9 Jun 2025 10:30:30 -0700 Subject: [PATCH] fix not passing parameter in case of timeout --- .../src/main/java/com/clickhouse/client/api/Client.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client-v2/src/main/java/com/clickhouse/client/api/Client.java b/client-v2/src/main/java/com/clickhouse/client/api/Client.java index 28cb4235f..b014dc99f 100644 --- a/client-v2/src/main/java/com/clickhouse/client/api/Client.java +++ b/client-v2/src/main/java/com/clickhouse/client/api/Client.java @@ -1671,8 +1671,8 @@ public List queryAll(String sqlQuery, Map params, int operationTimeout = getOperationTimeout(); settings.setFormat(ClickHouseFormat.RowBinaryWithNamesAndTypes) .waitEndOfQuery(true); - try (QueryResponse response = operationTimeout == 0 ? query(sqlQuery, params, settings).get() : - query(sqlQuery, settings).get(operationTimeout, TimeUnit.MILLISECONDS)) { + CompletableFuture f = query(sqlQuery, params, settings); + try (QueryResponse response = operationTimeout == 0 ? f.get() : f.get(operationTimeout, TimeUnit.MILLISECONDS)) { List records = new ArrayList<>(); if (response.getResultRows() > 0) { RowBinaryWithNamesAndTypesFormatReader reader = @@ -1738,8 +1738,8 @@ public List queryAll(String sqlQuery, Class clazz, TableSchema schema, try { int operationTimeout = getOperationTimeout(); QuerySettings settings = new QuerySettings().setFormat(ClickHouseFormat.RowBinaryWithNamesAndTypes); - try (QueryResponse response = operationTimeout == 0 ? query(sqlQuery, settings).get() : - query(sqlQuery, settings).get(operationTimeout, TimeUnit.MILLISECONDS)) { + CompletableFuture f = query(sqlQuery, settings); + try (QueryResponse response = operationTimeout == 0 ? f.get() : f.get(operationTimeout, TimeUnit.MILLISECONDS)) { List records = new ArrayList<>(); RowBinaryWithNamesAndTypesFormatReader reader = (RowBinaryWithNamesAndTypesFormatReader) newBinaryFormatReader(response);