Cast pushdown for duckdb#8620
Conversation
a3ecf3a to
2ae987d
Compare
Merging this PR will not alter performance
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | chunked_bool_canonical_into[(1000, 10)] |
15.9 µs | 26.4 µs | -39.73% |
| ❌ | Simulation | slice_empty_vortex |
339.4 ns | 397.8 ns | -14.66% |
| ❌ | Simulation | chunked_varbinview_canonical_into[(100, 100)] |
224.4 µs | 259.6 µs | -13.55% |
| ❌ | Simulation | chunked_varbinview_into_canonical[(100, 100)] |
271.5 µs | 306.7 µs | -11.5% |
| ⚡ | Simulation | chunked_varbinview_into_canonical[(1000, 10)] |
205.7 µs | 169 µs | +21.74% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[128] |
244.4 ns | 215.3 ns | +13.55% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[1024] |
304.7 ns | 275.6 ns | +10.58% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing myrrc/duckdb-cast-pushdown (67f11c8) with develop (5d3be01)
Footnotes
-
4 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. ↩
2ae987d to
c7fd89e
Compare
|
What about constant+bool arrays? |
c7fd89e to
eda2b58
Compare
eda2b58 to
9c15b8e
Compare
Polar Signals Profiling ResultsLatest Run
Previous Runs (1)
Powered by Polar Signals Cloud |
Polar Signals Profiling ResultsLatest Run
Powered by Polar Signals Cloud |
Benchmarks: PolarSignals ProfilingVortex (geomean): 0.996x ➖ How to read Verdict and Engines
datafusion / vortex-file-compressed (0.996x ➖, 1↑ 0↓)
No file size changes detected. |
Benchmarks: TPC-H SF=1 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.951x ➖, 2↑ 0↓)
datafusion / vortex-compact (0.958x ➖, 1↑ 0↓)
datafusion / parquet (0.973x ➖, 4↑ 0↓)
datafusion / arrow (0.932x ➖, 7↑ 0↓)
duckdb / vortex-file-compressed (0.988x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.969x ➖, 0↑ 0↓)
duckdb / parquet (0.992x ➖, 0↑ 1↓)
duckdb / duckdb (0.970x ➖, 0↑ 0↓)
File Size Changes (9 files changed, +0.0% overall, 6↑ 3↓)
Totals:
|
Benchmarks: FineWeb NVMeVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.987x ➖, 1↑ 0↓)
datafusion / vortex-compact (1.022x ➖, 0↑ 0↓)
datafusion / parquet (1.020x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (1.002x ➖, 0↑ 0↓)
duckdb / vortex-compact (1.029x ➖, 0↑ 1↓)
duckdb / parquet (1.008x ➖, 0↑ 0↓)
File Size Changes (1 files changed, +0.0% overall, 1↑ 0↓)
Totals:
|
Benchmarks: TPC-DS SF=1 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.004x ➖, 0↑ 0↓)
datafusion / vortex-compact (0.997x ➖, 0↑ 0↓)
datafusion / parquet (1.000x ➖, 3↑ 0↓)
duckdb / vortex-file-compressed (0.964x ➖, 6↑ 2↓)
duckdb / vortex-compact (0.984x ➖, 3↑ 0↓)
duckdb / parquet (0.979x ➖, 1↑ 1↓)
duckdb / duckdb (0.992x ➖, 1↑ 3↓)
File Size Changes (7 files changed, +0.0% overall, 3↑ 4↓)
Totals:
|
Benchmarks: TPC-H SF=10 on NVMEVerdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.180x ❌, 0↑ 18↓)
datafusion / vortex-compact (1.261x ❌, 0↑ 20↓)
datafusion / parquet (1.294x ❌, 0↑ 20↓)
datafusion / arrow (1.091x ➖, 2↑ 7↓)
duckdb / vortex-file-compressed (1.089x ➖, 0↑ 9↓)
duckdb / vortex-compact (1.126x ❌, 0↑ 14↓)
duckdb / parquet (1.099x ➖, 0↑ 8↓)
duckdb / duckdb (1.096x ➖, 0↑ 10↓)
File Size Changes (26 files changed, +0.0% overall, 15↑ 11↓)
Totals:
|
Benchmarks: Statistical and Population GeneticsVerdict: No clear signal (medium confidence) How to read Verdict and Engines
duckdb / vortex-file-compressed (1.143x ❌, 0↑ 6↓)
duckdb / vortex-compact (1.124x ❌, 0↑ 6↓)
duckdb / parquet (1.023x ➖, 0↑ 0↓)
File Size Changes (1 files changed, -0.0% overall, 0↑ 1↓)
Totals:
|
Benchmarks: FineWeb S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.422x ❌, 0↑ 4↓)
datafusion / vortex-compact (0.991x ➖, 0↑ 1↓)
datafusion / parquet (1.008x ➖, 0↑ 1↓)
duckdb / vortex-file-compressed (0.995x ➖, 0↑ 1↓)
duckdb / vortex-compact (1.004x ➖, 0↑ 0↓)
duckdb / parquet (0.974x ➖, 0↑ 0↓)
|
Benchmarks: Clickbench Sorted on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.932x ➖, 2↑ 0↓)
datafusion / parquet (0.944x ➖, 3↑ 0↓)
duckdb / vortex-file-compressed (0.907x ➖, 5↑ 0↓)
duckdb / parquet (0.938x ➖, 1↑ 0↓)
duckdb / duckdb (0.921x ➖, 4↑ 0↓)
File Size Changes (201 files changed, -0.0% overall, 103↑ 98↓)
Totals:
|
Benchmarks: TPC-H SF=1 on S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.889x ➖, 4↑ 2↓)
datafusion / vortex-compact (0.776x ➖, 8↑ 0↓)
datafusion / parquet (0.882x ➖, 4↑ 4↓)
duckdb / vortex-file-compressed (0.937x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.973x ➖, 0↑ 0↓)
duckdb / parquet (0.967x ➖, 0↑ 0↓)
|
Benchmarks: Clickbench on NVMEVerdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.272x ❌, 0↑ 37↓)
datafusion / parquet (1.085x ➖, 0↑ 18↓)
duckdb / vortex-file-compressed (1.175x ❌, 0↑ 27↓)
duckdb / parquet (1.155x ❌, 0↑ 32↓)
duckdb / duckdb (1.085x ➖, 0↑ 18↓)
File Size Changes (107 files changed, +0.0% overall, 53↑ 54↓)
Totals:
|
Benchmarks: Random AccessVortex (geomean): 0.953x ➖ How to read Verdict and Engines
unknown / unknown (1.024x ➖, 8↑ 3↓)
|
Benchmarks: Appian on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.946x ➖, 0↑ 0↓)
datafusion / parquet (0.938x ➖, 1↑ 0↓)
duckdb / vortex-file-compressed (0.975x ➖, 0↑ 0↓)
duckdb / parquet (0.983x ➖, 0↑ 0↓)
duckdb / duckdb (0.978x ➖, 0↑ 0↓)
File Size Changes (4 files changed, -0.0% overall, 0↑ 4↓)
Totals:
|
Benchmarks: TPC-H SF=10 on S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.958x ➖, 2↑ 1↓)
datafusion / vortex-compact (0.908x ➖, 3↑ 0↓)
datafusion / parquet (0.900x ➖, 1↑ 2↓)
duckdb / vortex-file-compressed (0.970x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.946x ➖, 0↑ 0↓)
duckdb / parquet (0.939x ➖, 0↑ 0↓)
|
Benchmarks: CompressionVortex (geomean): 1.004x ➖ How to read Verdict and Engines
unknown / unknown (1.022x ➖, 1↑ 4↓)
|
9c15b8e to
67f11c8
Compare
|
@claude in depth review |
|
Claude finished @0ax1's task in 3m 47s —— View job Claude In-Depth Review — Cast pushdown for DuckDBReviewed the DuckDB cast-pushdown optimizer pass (C++), the Rust conversion/guard logic, and the SLT coverage. The refactor extracting the shared 🔴 Correctness: float→int casts diverge (truncate vs. round)
That's a silent wrong-result difference once a float→int cast is pushed. The existing SLT tests only exercise integer→integer casts of in-range values ( Options: exclude float-source casts in 🟠 Missing test: out-of-range
|
| * record in "analyses.conflicts" | ||
| */ | ||
| struct CastCollect final : LogicalOperatorVisitor { | ||
| Analyses &analyses; |
There was a problem hiding this comment.
What is the ownership model here? Can we access a stale ref? Same for all other refs and pointers.
There was a problem hiding this comment.
No, the analysis lives on the stack of pushdown function, and the visitor's lifetime is less than lifetime of the function.
For pointers, we reference the query plan which will outlive the optimizer, and we either read (Collect) or modify (Replace) the pointers. Optimizers run sequentially so there's no risk the pointers will be invalidated.
There was a problem hiding this comment.
Can we drop a doc line concisely what the ownership model is?
| Collect(analyses, projections).VisitOperator(*plan); | ||
|
|
||
| bool any_pushed = false; | ||
| for (auto &[_, analysis] : analyses) { |
There was a problem hiding this comment.
Would Sean Parent approve this loop? :)
|
Whats your take on: |
|
That's a good find, I'll open a PR to Vortex to match the semantics duckdb does since it's what other DBMS do as well. Same for tests, worth adding. I'll rebase once I'm done |
We are overly restrictive here because we don't want clients to face issues like
No CastReduce to cast constant array from vortex.date[days](i32) to vortex.timestamp[µs](i64?). We can lift the restriction later.