Skip to content

fix(expression): type JSON paths in pushed-down CEL filters - #180

Merged
catinspace-au merged 1 commit into
mainfrom
fix/cel-json-types
Nov 11, 2026
Merged

catinspace-au merged 1 commit into
mainfrom
fix/cel-json-types

Conversation

@catinspace-au

Copy link
Copy Markdown
Contributor

ClickHouse infers a dynamic JSON path's type per row. One String or Array at a path breaks every filter transpiled for that path. doc.a > 10 failed with NO_COMMON_TYPE. IN failed on any JSON path. String functions failed on the first Int64 row. doc.p == "8080" ran but matched the number 8080 as well.

transpile_to_clickhouse takes json_columns. For paths under those columns, the other operand picks the typed sub-column. Numbers use .:Int64, .:UInt64 and .:Float64. Strings use .:String. Bools use .:Bool.

Equality returns false rather than NULL for a row of another type, so != and a negated == keep CEL's answer. Conversions, size(), string methods and arithmetic read the sub-columns they accept. A comparison raises TranspileError if only the data can determine its type.

The integration test runs 46 filters against a JSON column holding six types at one path. It checks each against evaluate_condition row by row.

ClickHouse infers a dynamic JSON path's type per row. One String or Array at a path breaks every filter transpiled for that path. `doc.a > 10` failed with NO_COMMON_TYPE. `IN` failed on any JSON path. String functions failed on the first Int64 row. `doc.p == "8080"` ran but matched the number 8080 as well.

transpile_to_clickhouse takes json_columns. For paths under those columns, the other operand picks the typed sub-column. Numbers use `.:Int64`, `.:UInt64` and `.:Float64`. Strings use `.:String`. Bools use `.:Bool`.

Equality returns false rather than NULL for a row of another type, so `!=` and a negated `==` keep CEL's answer. Conversions, size(), string methods and arithmetic read the sub-columns they accept. A comparison raises TranspileError if only the data can determine its type.

The integration test runs 46 filters against a JSON column holding six types at one path. It checks each against evaluate_condition row by row.
@catinspace-au
catinspace-au marked this pull request as ready for review November 11, 2026 05:17
@catinspace-au
catinspace-au merged commit 1f19b11 into main Nov 11, 2026
17 checks passed
@catinspace-au
catinspace-au deleted the fix/cel-json-types branch November 11, 2026 05:17
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