Skip to content

DRAFT Bench 25767 - #26368

Draft
kosiew wants to merge 7 commits into
apache:mainfrom
kosiew:bench-25767
Draft

kosiew wants to merge 7 commits into
apache:mainfrom
kosiew:bench-25767

Conversation

@kosiew

@kosiew kosiew commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

rebased
benchmarking 25767

kosiew and others added 7 commits October 15, 2026 20:02
…harness

- Added benchmarks/sql_benchmarks/set_operations/ using shared Criterion harness
Signed-off-by: Stefan Wang <1fannnw@gmail.com>
Signed-off-by: Stefan Wang <1fannnw@gmail.com>
Both sides used the same name for their synthetic row number column,
so the sides were always requalified as `left` and `right`, and the
final projection rebuilt every output column as `left.<name>`. Queries
that referred to the original qualifier after the set operation failed,
and two columns with the same name from different relations on one side
collapsed into duplicate `left.x` outputs.

Give each side its own row number name so requalification only happens
when the user's columns conflict, join on the columns the requalified
schemas actually contain, and alias the output back to the left input's
qualifiers and names.

Signed-off-by: Stefan Wang <1fannnw@gmail.com>
Document that `LogicalPlanBuilder::intersect` and `except` with
`is_all = true` do not preserve duplicate counts and point callers at
`intersect_all` and `except_all`. Name the operation in the planning
error raised when `row_number` is not registered, and add an upgrade
guide entry for custom context providers and session states.

The Substrait `intersect_rel` helper is now only used for distinct
intersections, so drop its `is_all` parameter.

Signed-off-by: Stefan Wang <1fannnw@gmail.com>
Add sqllogictest cases for min and max duplicate counts with NULLs,
rows that are NULL in only some columns, INTERSECT ALL binding tighter
than EXCEPT ALL, and the two qualifier regressions.

Record the +0.0 / -0.0 case as a known issue: window partitioning puts
the two values in separate partitions, so the counts are wrong until
apache#25766 is fixed.

Signed-off-by: Stefan Wang <1fannnw@gmail.com>
Count each distinct row on both sides, join the counts, and repeat each
row min(m, n) or m - n times with unnest(range(..)). This replaces the
per-row row_number window, which was slow when most rows are distinct.
Grouping also treats 0.0 and -0.0 as equal, so those counts are now right.

Signed-off-by: Stefan Wang <1fannnw@gmail.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation sql SQL Planner logical-expr Logical plan and expressions core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate labels Oct 15, 2026
@kosiew

kosiew commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

run benchmark sql

env:
  BENCH_NAME: set_operations
  PARTITIONS: 4
baseline:
  ref: 2cba9d87ee

@kosiew

kosiew commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

show benchmark queue

@adriangbot

Copy link
Copy Markdown

Hi @kosiew, you asked to view the benchmark queue (#26368 (comment)).

Comment Repo PR User Benchmarks Status
#6191650528 apache/datafusion #26368 kosiew ["sql"] running

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6191650528-3438-9rxhq 6.12.94+ #1 SMP Fri Aug 21 08:00:16 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing bench-25767 (5a8f209) to 2cba9d8 diff

Run configuration
run benchmark sql
env:
  BENCH_NAME: "set_operations"
  PARTITIONS: "4"
baseline:
  ref: "2cba9d87ee"

Results will be posted here when complete


File an issue against this benchmark runner

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.89583% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.85%. Comparing base (cf4869c) to head (5a8f209).

Files with missing lines Patch % Lines
datafusion/expr/src/logical_plan/builder.rs 88.96% 7 Missing and 9 partials ⚠️
...substrait/src/logical_plan/consumer/rel/set_rel.rs 45.00% 2 Missing and 9 partials ⚠️
datafusion/core/src/dataframe/mod.rs 81.81% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #26368    +/-   ##
========================================
  Coverage   82.84%   82.85%            
========================================
  Files        1151     1151            
  Lines      455961   456143   +182     
  Branches   455961   456143   +182     
========================================
+ Hits       377760   377929   +169     
+ Misses      55245    55244     -1     
- Partials    22956    22970    +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

Comparing bench-25767 (5a8f209) to 2cba9d8 diff

Run configuration
run benchmark sql
env:
  BENCH_NAME: "set_operations"
  PARTITIONS: "4"
baseline:
  ref: "2cba9d87ee"
CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

group                            HEAD                                   bench-25767
-----                            ----                                   -----------
set_operations/Q01_distinct      1.00     14.6±0.14ms        ? ?/sec    3.16     46.0±1.17ms        ? ?/sec
set_operations/Q02_distinct      1.00     14.5±0.11ms        ? ?/sec    3.17     45.9±0.98ms        ? ?/sec
set_operations/Q03_duplicates                                           1.00      7.9±0.04ms        ? ?/sec
set_operations/Q04_duplicates                                           1.00      8.1±0.07ms        ? ?/sec
set_operations/Q05_skew                                                 1.00     10.5±0.18ms        ? ?/sec
set_operations/Q06_skew                                                 1.00     10.6±0.08ms        ? ?/sec
set_operations/Q07_control                                              1.00     26.5±0.30ms        ? ?/sec
set_operations/Q08_control                                              1.00     26.6±0.53ms        ? ?/sec

Resource Usage

sql — branch

Metric Value
Wall time 840.3s
Peak memory 580.8 MiB
Avg memory 38.1 MiB
CPU user 285.5s
CPU sys 5.4s
Peak spill 0 B

File an issue against this benchmark runner

@kosiew

kosiew commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

run benchmark sql

env:
  BENCH_NAME: set_operations
  PARTITIONS: 4
baseline:
  ref: fa66d51c1b

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6193964849-3448-5kwk5 6.12.94+ #1 SMP Fri Aug 21 08:00:16 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing bench-25767 (5a8f209) to fa66d51 diff

Run configuration
run benchmark sql
env:
  BENCH_NAME: "set_operations"
  PARTITIONS: "4"
baseline:
  ref: "fa66d51c1b"

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

Comparing bench-25767 (5a8f209) to fa66d51 diff

Run configuration
run benchmark sql
env:
  BENCH_NAME: "set_operations"
  PARTITIONS: "4"
baseline:
  ref: "fa66d51c1b"
CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

New benchmark — branch-only Criterion results:

group                            bench-25767
-----                            -----------
set_operations/Q01_distinct      1.00     46.6±1.10ms        ? ?/sec
set_operations/Q02_distinct      1.00     47.2±1.36ms        ? ?/sec
set_operations/Q03_duplicates    1.00      7.9±0.10ms        ? ?/sec
set_operations/Q04_duplicates    1.00      8.1±0.11ms        ? ?/sec
set_operations/Q05_skew          1.00     10.7±0.15ms        ? ?/sec
set_operations/Q06_skew          1.00     10.6±0.19ms        ? ?/sec
set_operations/Q07_control       1.00     27.9±0.54ms        ? ?/sec
set_operations/Q08_control       1.00     28.0±0.75ms        ? ?/sec

Resource Usage

sql — branch

Metric Value
Wall time 460.2s
Peak memory 574.1 MiB
Avg memory 69.3 MiB
CPU user 289.8s
CPU sys 5.6s
Peak spill 0 B

File an issue against this benchmark runner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate documentation Improvements or additions to documentation logical-expr Logical plan and expressions sql SQL Planner sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants