Skip to content

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

Closed
@otan

Description

@otan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions