Push down JSONB existence predicates - #325
Conversation
theory
left a comment
There was a problem hiding this comment.
Thank you, looks handy, but the tests are insufficient. Can you improve them?
There was a problem hiding this comment.
This test does not properly validate execution on the ClickHouse side. Please create the corresponding tables and data in ClickHouse and execute the queries with and without EXPLAIN (VERBOSE COSTS OFF to show both the CH SQL generated and its successful execution.
There was a problem hiding this comment.
Updated in 9fa88ff.
The regression now creates the native JSON and Nullable(String)-backed tables in ClickHouse, inserts representative object, array, scalar, and NULL data, and runs each predicate both with EXPLAIN (VERBOSE, COSTS OFF) and as an executing query. The expected output includes the full generated ClickHouse SQL and returned rows for native JSON, String-backed compatibility views, combined predicates, and the intentionally local fallback.
Validation:
make -j2- Full focused regression against PostgreSQL 18 / ClickHouse 26.3 on an isolated Kharkiv test database
- The same test update was applied to
agent/v0.3.2-analytics-backportsat 1869dcf
The PR branch was also rebased onto current main. GitHub Actions are currently awaiting maintainer approval.
There was a problem hiding this comment.
@theory I want to add that this has been used in (relatively-heavy) production instances at my org for quite some time, ever since PR was opened
15ce62a to
9fa88ff
Compare
Summary
jsonb ? textpredicates down for native ClickHouse JSON columns.Stringcolumns, while leaving arbitrary JSON expressions local.Validation
make -j2EXPLAIN (FORMAT JSON, VERBOSE)confirmed thatJSONHas, nullable-document handling, andcountwere all executed remotely; a month-range aggregate completed successfully, and a pushed single-row predicate matched a deliberately local PostgreSQL evaluation on the same replicated row