Add TPC-DS SLT plan tests - #9861
Conversation
Merging this PR will improve performance by 12.08%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | allocate_drop_arrow[0] |
456.9 ns | 402.7 ns | +13.45% |
| ⚡ | WallTime | mul_u32_nonnull_avx512 |
6.2 µs | 5.6 µs | +10.72% |
| 🆕 | Simulation | scalar_access[(1, false, false)] |
N/A | 208.9 µs | N/A |
| 🆕 | Simulation | scalar_access[(1024, false, false)] |
N/A | 132.3 ms | N/A |
| 🆕 | Simulation | scalar_access[(1024, false, true)] |
N/A | 133.3 ms | N/A |
| 🆕 | Simulation | scalar_access[(1024, true, false)] |
N/A | 100.8 ms | N/A |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing ji/tpcds-slt-plans (05cb89f) with develop (d69291f)2
Footnotes
-
218 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
develop(5c8cac4) during the generation of this report, so d69291f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
DuckDB's common-subplan optimizer keys a scan on its serialized form. The Vortex table function keeps pushed-down filters, projections and aggregates in its FFI bind data, which has no serializer, so two scans of the same file with different pushed-down filters serialized identically and were merged into one shared CTE, handing one branch the other's rows. Parquet is unaffected because its filters live in `table_filters`, which are serialized. Setting `verify_serialization = false` is how DuckDB expects a function with opaque bind data to opt out of plan serialization, and therefore of subplan merging. TPC-DS q28 is what surfaced this: its six quantity buckets all returned the fifth bucket's average. The TPC-H q11 DuckDB plan is regenerated: its scalar subquery is no longer folded into a shared CTE, so the plan gains the scans it used to read back through `CTE_SCAN`. Results are unchanged. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L57FHoJ15heJVNaqgRq7xB
Mirror the TPC-H and ClickBench SLT layout for TPC-DS at scale factor 0.1. `slt/tpcds/generate_data.sh` generates the 24 tables with DuckDB's tpcds extension, exports them to Parquet, converts each to Vortex, and runs `duckdb/parity.slt`, which reads every table in both formats through DuckDB and fails if any row differs. The wrapper `slt/generate_data.sh` accepts `tpcds` like the other datasets. Each engine gets `plans/q1` to `plans/q99` from the upstream queries in `vortex-bench/sql/tpcds`, run unchanged, and `tpcds.slt` asserts the EXPLAIN plans against Vortex. All 99 queries plan on both engines. Result records and the Parquet comparison follow separately, so this change is only the plans. The runner treats TPC-DS like the other generated-data suites: its tests are ignored until both fixture formats exist. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L57FHoJ15heJVNaqgRq7xB
c5957b6 to
6fa1cf0
Compare
Bring the branch up to date with develop and re-run CI, whose previous run hit a cluster of network failures in job setup (DuckDB source download, flatc download, CodSpeed CLI install). Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A4nMxew6miuF54SW4HYA1G
Summary
First of two stacked PRs bringing TPC-DS into the SLT suite, following the same layout as TPC-H (#9794 did the equivalent for ClickBench). This one adds the fixtures and the EXPLAIN plans; result records and the Parquet comparison follow in the PR stacked on top.
It also carries a DuckDB correctness fix that has to land with or before the plans, because without it the recorded plans would contain shared CTEs that the fix removes.
Changes
TPC-DS fixtures and plans
slt/tpcds/generate_data.shgenerates the 24 tables with DuckDB'stpcdsextension throughuvx, exports them to Parquet, converts each to Vortex withvx convert, and then runsduckdb/parity.slt, which reads every table in both formats through DuckDB and fails if any row differs.slt/generate_data.shacceptstpcdslike the other datasets; CI already calls the wrapper.create.slt.no,drop.slt.noandplans/q1.slt.notoplans/q99.slt.no, from the upstream queries invortex-bench/sql/tpcds, run unchanged.tpcds.sltasserts the plans against Vortex (EXPLAIN (FORMAT json)withexplain_output = 'all'on DuckDB). All 99 queries plan on both engines.Most of the diff is the 198 generated plan files; the hand-written part is the generator, the two
tpcds.sltdrivers,parity.slt, and a four-line runner change.DuckDB: stop merging Vortex scans that have different pushdown
DuckDB's common-subplan optimizer keys a scan on its serialized form. The Vortex table function keeps pushed-down filters, projections and aggregates in its FFI bind data, which has no serializer, so two scans of the same file with different pushed-down filters serialized identically and were merged into one shared CTE, handing one branch the other's rows. Parquet is unaffected because its filters live in
table_filters, which are serialized. Settingverify_serialization = falseis how DuckDB expects a function with opaque bind data to opt out of plan serialization, and therefore of subplan merging.TPC-DS q28 is what surfaced this: its six quantity buckets all returned the fifth bucket's average. Those queries are covered by the result records in the stacked PR.
The TPC-H q11 DuckDB plan is regenerated as a consequence: its scalar subquery is no longer folded into a shared CTE, so the plan gains the scans it previously read back through
CTE_SCAN. TheCTEandCTE_SCANnodes disappear, no cardinality estimate changes value, and q11's results are unchanged.API Changes
verify_serialization = falseon the Vortex DuckDB table function opts its plans out of serialization. The visible effect is that DuckDB no longer merges two Vortex scans of the same file into one shared subplan, which changes recorded EXPLAIN output for queries that scan a file more than once. Query results only change where they were previously wrong.Testing
The TPC-DS plan files are the new tests. I could not run them in this environment — the container has no
flatc, sovortex-sqllogictestdoes not build here at all (failed to run flatc: No such file or directory); this is unrelated to the change. Verification is left to CI.Earlier in this work, on the combined branch, the full TPC-DS suite passed on both engines, and the
verify_serializationchange was confirmed to be what fixes q28.🤖 Generated with Claude Code
https://claude.ai/code/session_01L57FHoJ15heJVNaqgRq7xB