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

Tuple(Nullable(...)) as param does not work #374

Open
otan opened this issue Jan 9, 2025 · 0 comments
Open

Tuple(Nullable(...)) as param does not work #374

otan opened this issue Jan 9, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@otan
Copy link

otan commented Jan 9, 2025

Describe the bug

Steps to reproduce

Try the following:

 await chClient.command({
    query: `SELECT t.2 FROM (SELECT arrayJoin([{tup: Tuple(String, Nullable(String))}]) t)`,
    query_params: { tup: new TupleParam(["aaa", null]) },
  });

It will fail with

ClickHouseError: Cannot parse quoted string: expected opening quote ''', got '\': value [('aaa',\N)] cannot be parsed as Array(Tuple(String, Nullable(String))) for query parameter 'tup'.

note: more sophisticated example as follows:

  await chClient.command({
    query: `SELECT t.2 FROM (SELECT arrayJoin({tup: Array(Tuple(String, Nullable(String)))}) t)`,
    query_params: {tup: [new TupleParam(["aaa", null])]},
  });

Expected behaviour

Above command to at least pass as a parameter.

Code example

See above

Error log

/Users/otan/adora-so/adora/node_modules/.pnpm/@[email protected]/node_modules/@clickhouse/client-common/dist/error/parse_error.js:35
        return new ClickHouseError(groups);
               ^

ClickHouseError: Cannot parse quoted string: expected opening quote ''', got '\': value ('aaa',\N) cannot be parsed as Tuple(String, Nullable(String)) for query parameter 'tup'.
    at parseError (/Users/otan/adora-so/adora/node_modules/.pnpm/@[email protected]/node_modules/packages/client-common/src/error/parse_error.ts:30:12)
    at ClientRequest.onResponse (/Users/otan/adora-so/adora/node_modules/.pnpm/@[email protected]/node_modules/packages/client-node/src/connection/node_base_connection.ts:495:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: '26',
  type: 'CANNOT_PARSE_QUOTED_STRING'
}

Configuration

Environment

  • Client version: 1.10.0
  • Language version: v20.17.0
  • OS: osx

ClickHouse server

  • ClickHouse Server version:
    Clickhouse Cloud:
clickhouse-cloud :) select version();

SELECT version()

Query id: 33373e3e-89e0-4225-862d-d3cf940ea2c1

   ┌─version()────┐
1. │ 24.8.1.10545 │
   └──────────────┘

1 row in set. Elapsed: 0.001 sec.
  • ClickHouse Server non-default settings, if any: none
@otan otan added the bug Something isn't working label Jan 9, 2025
@otan otan changed the title support for Tuple(Nullable(...)) as param Tuple(Nullable(...)) as param does not work Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant