Skip to content

fix(clickhouse): cast array and map comparison literals to the column type - #44

Merged
Makisuo merged 2 commits into
fix/fromquery-select-allfrom
fix/ch-array-literal-cast
Oct 23, 2026
Merged

Makisuo merged 2 commits into
fix/fromquery-select-allfrom
fix/ch-array-literal-cast

Conversation

@Makisuo

@Makisuo Makisuo commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

On ClickHouse an array or map compared with a column was written bare, so its type came from its values: [0, 4294967296] is Array(UInt64), which does not compare with an Array(Nullable(Int64)) column (ILLEGAL_TYPE_OF_ARGUMENT). Comparison literals for Array and Map columns are now CAST(<literal> AS <column type>), including each IN element. Bound values (Postgres) and column DEFAULT expressions are unchanged.

Verification: new test in literal.test.ts, updated expectations for the cast form; Array/Map literal fuzz at 50× against ClickHouse 25.8; full suite.


Stack (merge bottom-up):

  1. test(fuzz): property-based fuzzer for the query builder #39 test(fuzz): property-based fuzzer for the query builder
  2. fix(clickhouse): write number literals that read back exactly #40 fix(clickhouse): write number literals that read back exactly
  3. fix: parenthesise an arithmetic expression passed as an argument #41 fix: parenthesise an arithmetic expression passed as an argument
  4. fix: fail with QueryBuilderError instead of throwing on unusable values #42 fix: fail with QueryBuilderError instead of throwing on unusable values
  5. fix: bare select() over a subquery or union selects every alias #43 fix: bare select() over a subquery or union selects every alias
  6. fix(clickhouse): cast array and map comparison literals to the column type #44 fix(clickhouse): cast array and map comparison literals to the column type
  7. fix(postgres): type the two placeholders Postgres would mistype #45 fix(postgres): type the two placeholders Postgres would mistype

🤖 Generated with Claude Code

… type

An array or map literal compared against a column was written bare, so
ClickHouse typed it from its values: `[0, 4294967296]` is Array(UInt64),
which does not compare with an Array(Nullable(Int64)) column
(ILLEGAL_TYPE_OF_ARGUMENT). Comparison literals for Array and Map columns
are now `CAST(<literal> AS <column type>)` on ClickHouse. Bound values
(Postgres) and column DEFAULT expressions are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Makisuo
Makisuo added this pull request to stack #46 October 23, 2026 00:18
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cac183e9-88eb-455f-9ef6-db4763e8d3cd
📥 Commits

Reviewing files that changed from the base of the PR and between 559f860 and 4384826.

📒 Files selected for processing: 7
  • .changeset/ch-array-literal-cast.md
  • src/ch/deep-builder.test.ts
  • src/ch/dialect.ts
  • src/ch/expr.ts
  • src/ch/literal.test.ts
  • src/sql/sql-syntax.ts
  • tests/fuzz/known-issues.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Makisuo Makisuo changed the title fix(clickhouse): cast array and map comparison literals to the column type fix: bare select() over a subquery or union selects every alias Oct 23, 2026
@Makisuo Makisuo changed the title fix: bare select() over a subquery or union selects every alias fix(clickhouse): cast array and map comparison literals to the column type Oct 23, 2026
@Makisuo
Makisuo merged commit 0bf4dbc into main Oct 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant