…ide-int types + EET roundtrip identities)
Implements the plan's Phase-1 P0 fast wins from
docs/plans/2026-06-13-001-feat-clickhouse-coverage-backlog-30-ideas-plan.md.
New differential / ground-truth oracles (each default-on, gated by a --flag,
self-contained, soundness-checklist-compliant):
- #2 PrewhereEquivalence WHERE == PREWHERE == optimize_move_to_prewhere=0 (multiset)
- #3 ReadInOrderToggle optimize_read_in_order/aggregation_in_order on==off
- #4 CountOptimization trivial/implicit/use_projections on==off + countIf cross-check
+ GROUP-BY-key count arm (hardens #106573, #106125)
- #5 LazyMaterializationToggle query_plan_optimize_lazy_materialization on==off (positional)
- #12 ReplacingDedup ReplacingMergeTree(ver) FINAL == argMax(val,ver) GROUP BY key
- sqlancer#19 QuantileConsistency quantileExact==medianExact, monotone-in-level, Low<=Exact<=High
- sqlancer#20 UniqExactness uniqExact == count(DISTINCT) == length(groupUniqArray)
- sqlancer#21 ArgExtremum argMax / arraySort(groupArray) / groupArraySorted vs Java truth
- sqlancer#28 MaterializedColumn MATERIALIZED/ALIAS col == defining expr (single-snapshot)
Generator/catalog:
- sqlancer#16 emit signed Int128/Int256 + Decimal256 (Decimal precision 39..76); Interval
column emission deliberately NOT added (ClickHouse forbids storing Interval in
tables); ClickHouseTypeParser gains an Interval read-back branch for free.
- sqlancer#23 EET roundtrip identities: unhex(hex), base64Decode(base64Encode),
tryBase64Decode(base64Encode), toIPv4(IPv4NumToString(toUInt32)),
toIPv6(IPv6NumToString) -- each type-gated; +7 unit-test cases.
Wired into ClickHouseOracleFactory, ClickHouseOptions (--*-oracle flags) and
.claude/run-sqlancer.sh ALL_ORACLES. mvn compile green; EETIdentitiesTest 20/20.
Probe-on-head items (recorded for dev-vm validation): query_plan_optimize_lazy_materialization,
read_in_order_use_buffering, optimize_trivial_count_query family, groupArraySorted/array text
format, IPv6 IPv4-mapped roundtrip.
Summary
Problem
The old JDBC driver (0.3.2) fails to properly handle compressed error responses from the ClickHouse server. When a query fails (e.g., ILLEGAL_TYPE_OF_ARGUMENT during table creation), the server sends an error response, but the old driver tries to decompress it using ClickHouse native LZ4 and fails with:
java.io.IOException: Magic is not correct - expect [-126] but got [-63] at com.clickhouse.client.data.ClickHouseLZ4InputStream.readNextBlockThis prevents SQLancer from matching the error against the expected errors list, causing it to throw AssertionError for every table creation failure. As a result, all 6 SQLancer tests report "Executed 0 queries" because database generation never completes.
Testing
Tested in ClickHouse CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98390&sha=3836c590894a3143dd6e2acfe182cb299b2e598a&name_0=PR&name_1=SQLancer%20%28amd_debug%29