Skip to content

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

@andris-rauda

Description

@andris-rauda

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions