Ungrouped aggregate function pushdown for duckdb#8645
Conversation
Signed-off-by: Mikhail Kot <mikhail@spiraldb.com>
|
As we don't have statistics attached to arrays, and we don't use precomputed statistics as Datafusion does, this PR would likely sit idle for some time until these are done, because currently there's no performance improvement compared to the default versions. There will be significant improvement once we add zone map statistics |
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 ➖, 2↑ 1↓)
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 (1.022x ➖, 0↑ 1↓)
datafusion / vortex-compact (1.007x ➖, 0↑ 0↓)
datafusion / parquet (1.031x ➖, 0↑ 0↓)
datafusion / arrow (1.076x ➖, 1↑ 7↓)
duckdb / vortex-file-compressed (0.999x ➖, 0↑ 0↓)
duckdb / vortex-compact (1.001x ➖, 0↑ 0↓)
duckdb / parquet (0.999x ➖, 2↑ 0↓)
duckdb / duckdb (0.995x ➖, 0↑ 0↓)
File Size Changes (10 files changed, -0.1% overall, 3↑ 7↓)
Totals:
|
🚨🚨🚨❌❌❌ SQL BENCHMARK FAILED ❌❌❌🚨🚨🚨Benchmark |
Benchmarks: FineWeb NVMeVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.014x ➖, 0↑ 0↓)
datafusion / vortex-compact (1.030x ➖, 0↑ 1↓)
datafusion / parquet (1.008x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (0.996x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.986x ➖, 0↑ 0↓)
duckdb / parquet (1.016x ➖, 0↑ 0↓)
File Size Changes (1 files changed, +0.0% overall, 1↑ 0↓)
Totals:
|
Benchmarks: Statistical and Population GeneticsVerdict: No clear signal (low confidence) How to read Verdict and Engines
duckdb / vortex-file-compressed (1.008x ➖, 0↑ 0↓)
duckdb / vortex-compact (1.003x ➖, 0↑ 0↓)
duckdb / parquet (0.997x ➖, 0↑ 0↓)
File Size Changes (1 files changed, +0.0% overall, 1↑ 0↓)
Totals:
|
Benchmarks: FineWeb S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.076x ➖, 1↑ 1↓)
datafusion / vortex-compact (1.144x ➖, 0↑ 3↓)
datafusion / parquet (1.124x ➖, 0↑ 1↓)
duckdb / vortex-file-compressed (1.014x ➖, 0↑ 0↓)
duckdb / vortex-compact (1.070x ➖, 0↑ 2↓)
duckdb / parquet (1.000x ➖, 0↑ 0↓)
|
Benchmarks: Clickbench Sorted on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.073x ➖, 0↑ 3↓)
datafusion / parquet (1.064x ➖, 0↑ 3↓)
duckdb / vortex-file-compressed (0.979x ➖, 2↑ 1↓)
duckdb / parquet (1.039x ➖, 0↑ 0↓)
duckdb / duckdb (1.021x ➖, 0↑ 0↓)
File Size Changes (201 files changed, -0.0% overall, 111↑ 90↓)
Totals:
|
Benchmarks: TPC-H SF=10 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.944x ➖, 0↑ 0↓)
datafusion / vortex-compact (0.962x ➖, 0↑ 0↓)
datafusion / parquet (0.949x ➖, 0↑ 0↓)
datafusion / arrow (0.924x ➖, 5↑ 0↓)
duckdb / vortex-file-compressed (0.957x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.945x ➖, 0↑ 0↓)
duckdb / parquet (0.974x ➖, 0↑ 0↓)
duckdb / duckdb (0.965x ➖, 0↑ 0↓)
File Size Changes (27 files changed, -0.0% overall, 10↑ 17↓)
Totals:
|
Merging this PR will not alter performance
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Benchmarks: Clickbench on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.051x ➖, 2↑ 7↓)
datafusion / parquet (1.045x ➖, 0↑ 5↓)
duckdb / vortex-file-compressed (1.032x ➖, 3↑ 3↓)
duckdb / parquet (1.022x ➖, 0↑ 1↓)
duckdb / duckdb (1.036x ➖, 0↑ 0↓)
File Size Changes (106 files changed, -0.0% overall, 50↑ 56↓)
Totals:
|
Benchmarks: Random AccessVortex (geomean): 0.947x ➖ How to read Verdict and Engines
unknown / unknown (0.981x ➖, 2↑ 1↓)
|
🚨🚨🚨❌❌❌ SQL BENCHMARK FAILED ❌❌❌🚨🚨🚨Benchmark |
Benchmarks: TPC-H SF=1 on S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.165x ➖, 0↑ 6↓)
datafusion / vortex-compact (1.061x ➖, 0↑ 3↓)
datafusion / parquet (1.167x ➖, 0↑ 6↓)
duckdb / vortex-file-compressed (0.935x ➖, 1↑ 0↓)
duckdb / vortex-compact (0.952x ➖, 0↑ 0↓)
duckdb / parquet (1.005x ➖, 0↑ 0↓)
|
Benchmarks: Appian on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.863x ✅, 7↑ 0↓)
datafusion / parquet (0.882x ✅, 7↑ 0↓)
duckdb / vortex-file-compressed (0.896x ✅, 6↑ 0↓)
duckdb / parquet (0.891x ✅, 5↑ 0↓)
duckdb / duckdb (0.910x ➖, 5↑ 0↓)
File Size Changes (4 files changed, -0.0% overall, 1↑ 3↓)
Totals:
|
Benchmarks: CompressionVortex (geomean): 0.996x ➖ How to read Verdict and Engines
unknown / unknown (0.965x ➖, 13↑ 2↓)
|
This PR adds support for pushing down ungropped aggregates min,max,sum,avg,mean,count(col), and count(*).
It consists of roughly 3 parts:
I've tried the implementation with CountStart being a separate accumulator, and it is much more complex than current one, because you can't provide a real column to accumulate on in select(), and you need to create a dummy one. So, we pay the cost of a separate atomic and a count_star positions vector, but our expression projection handling stays simple.
We also reject count(*) if it's the only aggregate because duckdb calculating it natively (just using chunk lengths) is faster than our accumulator pipeline
On the API input note, nearly all aggregate functions except for count_star() in duckdb have one non-const argument so input is a pair of a column and an expression.