Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-v2: queryParams are not passed to server in Client.queryAll method for non-zero executionTimeout #2096

Open
andris-rauda opened this issue Jan 17, 2025 · 0 comments

Comments

@andris-rauda
Copy link

andris-rauda commented Jan 17, 2025

Describe the bug

Client.queryAll method does not pass params to query method, if executionTimeout is not 0:

try (QueryResponse response = operationTimeout == 0 ? query(sqlQuery, params, settings).get() :
    query(sqlQuery, settings).get(operationTimeout, TimeUnit.MILLISECONDS)) {

Steps to reproduce

  1. Create client-v2 Client with non-zero executionTimeout
  2. Call queryAll method with query parameters
  3. Query fails with "Code: 456. DB::Exception: Substitution ... is not set."

Expected behaviour

Query parameters should be passed same as in query / queryRecords methods.

Code example

Client client = new Client.Builder()
            .addEndpoint(url)
            .setUsername(username)
            .setPassword(password)
            .setExecutionTimeout(2, ChronoUnit.SECONDS)
            .build();
List<GenericRecord> result = client.queryAll(
            "SELECT * FROM users WHERE name = {param1:String}", 
            Map.of("param1", "Bob"));

Error log

com.clickhouse.client.api.ServerException: Code: 456. DB::Exception: Substitution `param1` is not set. (UNKNOWN_QUERY_PARAMETER) (version 24.12.2.29 (official build)) 
	at com.clickhouse.client.api.internal.HttpAPIClientHelper.readError(HttpAPIClientHelper.java:340)
	at com.clickhouse.client.api.internal.HttpAPIClientHelper.executeRequest(HttpAPIClientHelper.java:388)
	at com.clickhouse.client.api.Client.lambda$query$11(Client.java:1706)
	at com.clickhouse.client.api.Client.runAsyncOperation(Client.java:2116)
	at com.clickhouse.client.api.Client.query(Client.java:1782)
	at com.clickhouse.client.api.Client.query(Client.java:1647)
	at com.clickhouse.client.api.Client.queryAll(Client.java:1864)

Configuration

Environment

  • Client version: 0.7.2
  • Language version: Java
  • OS: MacOS

ClickHouse server

  • ClickHouse Server version: 24.12.2.29
  • CREATE TABLE statements for tables involved:
CREATE TABLE IF NOT EXISTS users(id Int64, name String ENGINE = ReplacingMergeTree PRIMARY KEY (id) ORDER BY (id)
andris-rauda pushed a commit to andris-rauda/clickhouse-java that referenced this issue Jan 17, 2025
…r in Client.queryAll method for non-zero executionTimeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants