Skip to content

Add group join physical optimizer#21995

Draft
nathanb9 wants to merge 3 commits intoapache:mainfrom
nathanb9:groupjoin-eliminate-extra-hash-build
Draft

Add group join physical optimizer#21995
nathanb9 wants to merge 3 commits intoapache:mainfrom
nathanb9:groupjoin-eliminate-extra-hash-build

Conversation

@nathanb9
Copy link
Copy Markdown
Contributor

@nathanb9 nathanb9 commented May 3, 2026

Rationale for this change

Some queries combining a join and a group-by on the same key can be executed as a single groupjoin operator. This optimization targets a common analytical pattern — dimension-fact joins where a smaller dimension table is joined with a larger fact table and aggregated by the join key.

This is based on research: Moerkotte & Neumann PVLDB 2011. The paper introduces the groupjoin algebraic equivalence and proves its correctness for both inner and outer joins, provided the join key is a key of the build side.

This PR implements the groupjoin operator and optimizer rule, using the memoizing groupjoin strategy from the paper: a single hash table serves as both the join lookup and the aggregation group table, with probe-side rows updating accumulators in-place. This eliminates the redundant hash table construction and intermediate result materialization that occur when the join and aggregate run as separate operators. This addresses #13243.

locally I saw: TPC-H Q13 (SF10): 299ms → 254ms (~15% faster), not zero regressions (with just groupjoin avoiding materialization so not including additional optimizations below)

What changes are included in this PR?

New physical operatorGroupJoinExec (physical-plan/src/joins/group_join.rs):

  • Builds a GroupValues hash table from the left (build) side
  • Probes with the right side, updating GroupsAccumulators in-place for matching rows
  • Tracks visited groups via a bitmap — Inner joins emit only visited groups, Left joins emit all groups
  • Supports Inner and Left join types

New physical optimizer ruleGroupJoinOptimizer (physical-optimizer/src/group_join.rs):

  • Pattern-matches AggregateExec above HashJoinExec (looking through intermediate ProjectionExec)
  • Activates when GROUP BY keys exactly match the join equi-keys, the join is Inner or Left with no residual filter, and all aggregates support GroupsAccumulator
  • Requires at least one aggregate expression (skips DISTINCT-only queries)
  • Registered after CombinePartialFinalAggregate in the optimizer pipeline

How can this be extended?

The paper describes three additional strategies and optimizations we did not implement:

Eager Right Aggregation (Strategy 1) — Pre-aggregate the probe side before the join, reducing its cardinality. For Q13, this would reduce the 15M order rows to ~1.5M pre-aggregated groups before joining with 1.5M customers. The paper reports >2x improvement on Q13 with this strategy.

  • Reopen: Add ForeignKey constraint type #8566 (Foreign key). With this data we can make a decisions with guarantees and avoid wasteful work when doing eager aggregations
    Superset GROUP BY (Theorem 3 in the paper) — Handle cases where GROUP BY keys are a superset of the join keys (extra keys from the build side). This would enable queries like Q3 (GROUP BY l_orderkey, o_orderdate, o_shippriority with join on o_orderkey = l_orderkey). Requires the probe side to look up by the join key subset while the hash table is keyed by the full GROUP BY.

Cost-model strategy selection (Section 4 of Fent et al.) — Choose between the four strategies at optimization time based on input cardinalities and selectivities, rather than always using Strategy 2.

@github-actions github-actions Bot added optimizer Optimizer rules physical-plan Changes to the physical-plan crate labels May 3, 2026
@nathanb9 nathanb9 force-pushed the groupjoin-eliminate-extra-hash-build branch from 73f4713 to 5fe7219 Compare May 3, 2026 08:30
@Dandandan
Copy link
Copy Markdown
Contributor

run benchmark tpch tpcds tpch10

@adriangbot
Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4365801233-1989-lsfg9 6.12.68+ #1 SMP Wed Apr 1 02:23:28 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 groupjoin-eliminate-extra-hash-build (5fe7219) to 2f2fe8f (merge-base) diff using: tpch10
Results will be posted here when complete


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-c4365801233-1987-99lwf 6.12.68+ #1 SMP Wed Apr 1 02:23:28 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 groupjoin-eliminate-extra-hash-build (5fe7219) to 2f2fe8f (merge-base) diff using: tpch
Results will be posted here when complete


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-c4365801233-1988-thp76 6.12.68+ #1 SMP Wed Apr 1 02:23:28 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 groupjoin-eliminate-extra-hash-build (5fe7219) to 2f2fe8f (merge-base) diff using: tpcds
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)

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

Comparing HEAD and groupjoin-eliminate-extra-hash-build
--------------------
Benchmark tpch_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃                           HEAD ┃ groupjoin-eliminate-extra-hash-build ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │ 40.51 / 41.47 ±1.15 / 43.37 ms │       41.01 / 41.80 ±0.90 / 43.53 ms │     no change │
│ QQuery 2  │ 21.45 / 21.53 ±0.07 / 21.61 ms │       21.68 / 22.36 ±0.63 / 23.15 ms │     no change │
│ QQuery 3  │ 37.25 / 38.91 ±1.31 / 40.15 ms │       39.34 / 39.93 ±0.45 / 40.70 ms │     no change │
│ QQuery 4  │ 18.40 / 18.88 ±0.64 / 20.13 ms │       18.79 / 19.13 ±0.46 / 20.04 ms │     no change │
│ QQuery 5  │ 44.92 / 46.54 ±1.21 / 47.73 ms │       44.39 / 46.33 ±1.58 / 48.29 ms │     no change │
│ QQuery 6  │ 17.55 / 19.55 ±2.66 / 24.54 ms │       17.49 / 17.54 ±0.05 / 17.61 ms │ +1.11x faster │
│ QQuery 7  │ 50.66 / 52.97 ±1.61 / 55.29 ms │       50.87 / 52.89 ±2.44 / 57.46 ms │     no change │
│ QQuery 8  │ 47.80 / 48.32 ±0.51 / 49.29 ms │       47.39 / 47.96 ±0.71 / 49.29 ms │     no change │
│ QQuery 9  │ 52.72 / 53.32 ±0.47 / 53.98 ms │       52.12 / 53.80 ±1.22 / 55.66 ms │     no change │
│ QQuery 10 │ 66.22 / 68.43 ±2.11 / 71.95 ms │       65.86 / 66.84 ±1.46 / 69.71 ms │     no change │
│ QQuery 11 │ 14.62 / 14.71 ±0.12 / 14.95 ms │       14.23 / 14.51 ±0.38 / 15.25 ms │     no change │
│ QQuery 12 │ 26.92 / 27.30 ±0.23 / 27.57 ms │       26.43 / 26.66 ±0.16 / 26.88 ms │     no change │
│ QQuery 13 │ 37.79 / 38.38 ±0.45 / 38.92 ms │       34.10 / 34.63 ±0.57 / 35.69 ms │ +1.11x faster │
│ QQuery 14 │ 28.13 / 28.82 ±1.24 / 31.30 ms │       27.15 / 27.24 ±0.10 / 27.43 ms │ +1.06x faster │
│ QQuery 15 │ 34.58 / 35.25 ±0.79 / 36.56 ms │       33.06 / 33.74 ±0.91 / 35.51 ms │     no change │
│ QQuery 16 │ 15.89 / 16.03 ±0.09 / 16.14 ms │       15.21 / 15.50 ±0.16 / 15.69 ms │     no change │
│ QQuery 17 │ 82.79 / 83.56 ±0.72 / 84.81 ms │       79.26 / 81.26 ±1.57 / 83.15 ms │     no change │
│ QQuery 18 │ 71.88 / 72.67 ±0.80 / 74.07 ms │       69.48 / 70.47 ±0.97 / 71.78 ms │     no change │
│ QQuery 19 │ 38.91 / 39.45 ±0.57 / 40.43 ms │       37.94 / 38.19 ±0.21 / 38.56 ms │     no change │
│ QQuery 20 │ 40.47 / 42.54 ±3.09 / 48.69 ms │       38.67 / 39.27 ±0.44 / 39.78 ms │ +1.08x faster │
│ QQuery 21 │ 64.54 / 65.53 ±0.82 / 66.54 ms │       61.01 / 63.12 ±2.04 / 65.70 ms │     no change │
│ QQuery 22 │ 24.93 / 25.12 ±0.14 / 25.33 ms │       23.97 / 24.29 ±0.19 / 24.49 ms │     no change │
└───────────┴────────────────────────────────┴──────────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ Benchmark Summary                                   ┃          ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ Total Time (HEAD)                                   │ 899.26ms │
│ Total Time (groupjoin-eliminate-extra-hash-build)   │ 877.46ms │
│ Average Time (HEAD)                                 │  40.88ms │
│ Average Time (groupjoin-eliminate-extra-hash-build) │  39.88ms │
│ Queries Faster                                      │        4 │
│ Queries Slower                                      │        0 │
│ Queries with No Change                              │       18 │
│ Queries with Failure                                │        0 │
└─────────────────────────────────────────────────────┴──────────┘

Resource Usage

tpch — base (merge-base)

Metric Value
Wall time 5.0s
Peak memory 5.5 GiB
Avg memory 5.0 GiB
CPU user 33.4s
CPU sys 2.4s
Peak spill 0 B

tpch — branch

Metric Value
Wall time 5.0s
Peak memory 5.5 GiB
Avg memory 5.0 GiB
CPU user 32.7s
CPU sys 2.3s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

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

Comparing HEAD and groupjoin-eliminate-extra-hash-build
--------------------
Benchmark tpch_sf10.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃                               HEAD ┃ groupjoin-eliminate-extra-hash-build ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │  326.46 / 329.67 ±1.75 / 331.68 ms │    326.43 / 328.23 ±1.32 / 329.77 ms │     no change │
│ QQuery 2  │  127.37 / 129.81 ±2.02 / 133.37 ms │    126.58 / 130.40 ±2.53 / 134.17 ms │     no change │
│ QQuery 3  │  272.42 / 275.25 ±2.59 / 278.82 ms │    270.00 / 271.82 ±2.23 / 276.06 ms │     no change │
│ QQuery 4  │  133.78 / 135.44 ±1.18 / 137.15 ms │    132.48 / 134.32 ±1.33 / 136.33 ms │     no change │
│ QQuery 5  │  397.37 / 400.05 ±2.40 / 404.15 ms │    390.60 / 396.60 ±5.07 / 402.57 ms │     no change │
│ QQuery 6  │  134.93 / 136.62 ±1.36 / 138.63 ms │    132.12 / 132.51 ±0.28 / 132.96 ms │     no change │
│ QQuery 7  │  512.82 / 521.74 ±6.58 / 531.96 ms │    500.14 / 507.94 ±5.47 / 513.52 ms │     no change │
│ QQuery 8  │  436.50 / 445.96 ±9.40 / 458.34 ms │    434.82 / 438.97 ±3.52 / 445.45 ms │     no change │
│ QQuery 9  │  613.37 / 629.91 ±9.73 / 640.93 ms │    613.53 / 621.81 ±5.31 / 629.74 ms │     no change │
│ QQuery 10 │  326.54 / 332.00 ±4.62 / 339.53 ms │    320.58 / 328.93 ±5.41 / 334.97 ms │     no change │
│ QQuery 11 │   98.08 / 104.46 ±6.63 / 114.97 ms │       95.01 / 96.51 ±1.52 / 99.19 ms │ +1.08x faster │
│ QQuery 12 │  194.85 / 200.06 ±8.06 / 216.08 ms │    192.66 / 196.59 ±3.85 / 203.93 ms │     no change │
│ QQuery 13 │  305.74 / 310.41 ±4.65 / 317.96 ms │    254.47 / 256.95 ±2.59 / 261.87 ms │ +1.21x faster │
│ QQuery 14 │  181.96 / 186.48 ±4.13 / 194.09 ms │    181.12 / 184.72 ±4.72 / 193.96 ms │     no change │
│ QQuery 15 │  332.60 / 336.40 ±2.21 / 338.60 ms │    326.21 / 329.72 ±1.95 / 332.00 ms │     no change │
│ QQuery 16 │     74.11 / 76.90 ±2.51 / 81.06 ms │       75.17 / 78.23 ±2.48 / 81.74 ms │     no change │
│ QQuery 17 │  692.18 / 700.77 ±7.48 / 712.56 ms │    690.23 / 695.00 ±3.49 / 700.98 ms │     no change │
│ QQuery 18 │  721.59 / 732.35 ±8.47 / 741.80 ms │   702.01 / 736.68 ±23.74 / 772.49 ms │     no change │
│ QQuery 19 │ 270.93 / 282.09 ±11.33 / 301.84 ms │   268.89 / 281.61 ±14.01 / 303.82 ms │     no change │
│ QQuery 20 │ 305.07 / 316.22 ±11.83 / 338.33 ms │    296.79 / 307.03 ±6.55 / 315.48 ms │     no change │
│ QQuery 21 │  750.74 / 761.43 ±6.45 / 767.75 ms │    741.90 / 750.38 ±6.19 / 760.94 ms │     no change │
│ QQuery 22 │     67.78 / 70.83 ±3.61 / 76.71 ms │       65.30 / 68.26 ±2.52 / 72.60 ms │     no change │
└───────────┴────────────────────────────────────┴──────────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                                   ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                                   │ 7414.84ms │
│ Total Time (groupjoin-eliminate-extra-hash-build)   │ 7273.18ms │
│ Average Time (HEAD)                                 │  337.04ms │
│ Average Time (groupjoin-eliminate-extra-hash-build) │  330.60ms │
│ Queries Faster                                      │         2 │
│ Queries Slower                                      │         0 │
│ Queries with No Change                              │        20 │
│ Queries with Failure                                │         0 │
└─────────────────────────────────────────────────────┴───────────┘

Resource Usage

tpch10 — base (merge-base)

Metric Value
Wall time 40.0s
Peak memory 11.8 GiB
Avg memory 8.4 GiB
CPU user 394.6s
CPU sys 21.1s
Peak spill 0 B

tpch10 — branch

Metric Value
Wall time 40.0s
Peak memory 11.9 GiB
Avg memory 8.4 GiB
CPU user 389.5s
CPU sys 20.4s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

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

Comparing HEAD and groupjoin-eliminate-extra-hash-build
--------------------
Benchmark tpcds_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Query     ┃                                     HEAD ┃     groupjoin-eliminate-extra-hash-build ┃       Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ QQuery 1  │              6.97 / 7.44 ±0.82 / 9.08 ms │              6.89 / 7.37 ±0.85 / 9.07 ms │    no change │
│ QQuery 2  │        142.80 / 143.20 ±0.28 / 143.60 ms │        142.81 / 143.51 ±0.55 / 144.33 ms │    no change │
│ QQuery 3  │        112.90 / 113.78 ±0.69 / 114.77 ms │        112.24 / 112.95 ±0.53 / 113.76 ms │    no change │
│ QQuery 4  │     1244.12 / 1252.98 ±6.76 / 1261.85 ms │     1238.40 / 1248.23 ±5.38 / 1253.53 ms │    no change │
│ QQuery 5  │        173.49 / 174.35 ±0.82 / 175.76 ms │        173.55 / 174.46 ±0.91 / 175.91 ms │    no change │
│ QQuery 6  │        127.89 / 131.00 ±1.83 / 133.48 ms │        127.66 / 131.35 ±3.52 / 136.23 ms │    no change │
│ QQuery 7  │        318.41 / 319.71 ±0.74 / 320.57 ms │        317.45 / 320.23 ±2.29 / 323.86 ms │    no change │
│ QQuery 8  │        112.21 / 112.81 ±0.69 / 114.16 ms │        112.37 / 113.48 ±1.12 / 115.62 ms │    no change │
│ QQuery 9  │         96.16 / 101.56 ±4.25 / 109.17 ms │        100.26 / 102.53 ±3.39 / 109.18 ms │    no change │
│ QQuery 10 │        100.57 / 102.10 ±2.15 / 106.24 ms │        102.04 / 102.54 ±0.58 / 103.54 ms │    no change │
│ QQuery 11 │       835.12 / 853.79 ±13.46 / 877.03 ms │       830.57 / 852.19 ±20.24 / 890.22 ms │    no change │
│ QQuery 12 │           42.43 / 43.06 ±0.44 / 43.79 ms │           42.26 / 42.93 ±0.51 / 43.80 ms │    no change │
│ QQuery 13 │        387.05 / 387.82 ±0.56 / 388.77 ms │        391.18 / 393.11 ±2.25 / 397.02 ms │    no change │
│ QQuery 14 │     1027.08 / 1031.48 ±3.69 / 1037.25 ms │     1036.99 / 1044.35 ±5.29 / 1049.89 ms │    no change │
│ QQuery 15 │           14.48 / 14.80 ±0.28 / 15.22 ms │           14.40 / 14.60 ±0.21 / 14.96 ms │    no change │
│ QQuery 16 │              7.34 / 7.49 ±0.23 / 7.94 ms │              7.44 / 7.55 ±0.14 / 7.82 ms │    no change │
│ QQuery 17 │        200.82 / 203.99 ±3.73 / 211.07 ms │        202.63 / 204.40 ±1.20 / 205.75 ms │    no change │
│ QQuery 18 │        122.18 / 123.52 ±0.90 / 124.88 ms │        123.01 / 124.89 ±1.11 / 126.32 ms │    no change │
│ QQuery 19 │        150.92 / 152.67 ±1.78 / 156.10 ms │        154.15 / 156.14 ±1.72 / 158.71 ms │    no change │
│ QQuery 20 │           12.82 / 13.20 ±0.32 / 13.66 ms │           12.98 / 13.36 ±0.32 / 13.95 ms │    no change │
│ QQuery 21 │           18.97 / 19.31 ±0.21 / 19.61 ms │           19.21 / 19.46 ±0.24 / 19.89 ms │    no change │
│ QQuery 22 │        468.09 / 472.98 ±4.24 / 478.89 ms │        477.58 / 482.41 ±3.86 / 488.05 ms │    no change │
│ QQuery 23 │     1007.08 / 1010.31 ±4.71 / 1019.62 ms │      997.91 / 1000.44 ±1.43 / 1002.31 ms │    no change │
│ QQuery 24 │        631.28 / 633.33 ±1.62 / 636.22 ms │        625.54 / 630.64 ±3.23 / 635.59 ms │    no change │
│ QQuery 25 │        303.36 / 304.32 ±0.96 / 305.66 ms │        301.03 / 304.02 ±1.60 / 305.83 ms │    no change │
│ QQuery 26 │           74.85 / 75.47 ±0.82 / 77.06 ms │           75.65 / 76.15 ±0.37 / 76.57 ms │    no change │
│ QQuery 27 │              6.95 / 7.04 ±0.10 / 7.23 ms │             6.99 / 8.16 ±1.96 / 12.06 ms │ 1.16x slower │
│ QQuery 28 │        146.91 / 148.52 ±1.56 / 151.00 ms │        146.90 / 147.42 ±0.54 / 148.35 ms │    no change │
│ QQuery 29 │        242.23 / 244.92 ±2.52 / 249.46 ms │        241.95 / 243.71 ±1.70 / 246.89 ms │    no change │
│ QQuery 30 │           40.99 / 41.79 ±0.77 / 43.24 ms │           40.85 / 41.80 ±1.14 / 44.04 ms │    no change │
│ QQuery 31 │        161.17 / 163.08 ±1.27 / 164.62 ms │        164.31 / 165.88 ±1.00 / 167.23 ms │    no change │
│ QQuery 32 │           13.09 / 13.33 ±0.30 / 13.91 ms │           12.87 / 13.16 ±0.27 / 13.66 ms │    no change │
│ QQuery 33 │        138.04 / 139.60 ±1.55 / 142.47 ms │        137.50 / 138.82 ±0.69 / 139.46 ms │    no change │
│ QQuery 34 │              6.93 / 7.08 ±0.21 / 7.50 ms │              6.90 / 7.08 ±0.22 / 7.50 ms │    no change │
│ QQuery 35 │        100.57 / 101.97 ±1.69 / 105.29 ms │         99.95 / 101.53 ±2.37 / 106.20 ms │    no change │
│ QQuery 36 │              6.69 / 6.83 ±0.12 / 7.01 ms │              6.61 / 6.90 ±0.16 / 7.04 ms │    no change │
│ QQuery 37 │              8.32 / 8.50 ±0.18 / 8.79 ms │              8.28 / 8.34 ±0.04 / 8.38 ms │    no change │
│ QQuery 38 │           85.01 / 86.17 ±1.01 / 87.30 ms │           84.81 / 85.47 ±0.66 / 86.59 ms │    no change │
│ QQuery 39 │        116.40 / 119.94 ±4.36 / 128.53 ms │        114.77 / 118.21 ±3.91 / 125.86 ms │    no change │
│ QQuery 40 │           92.62 / 95.25 ±1.81 / 97.45 ms │           92.69 / 95.26 ±1.98 / 98.21 ms │    no change │
│ QQuery 41 │           14.22 / 14.44 ±0.24 / 14.91 ms │           14.39 / 14.57 ±0.24 / 15.03 ms │    no change │
│ QQuery 42 │        106.36 / 108.00 ±2.03 / 111.98 ms │        106.03 / 107.14 ±1.30 / 109.67 ms │    no change │
│ QQuery 43 │              5.76 / 6.51 ±1.28 / 9.04 ms │              5.84 / 6.44 ±0.96 / 8.35 ms │    no change │
│ QQuery 44 │           10.29 / 10.47 ±0.13 / 10.70 ms │           10.51 / 10.57 ±0.06 / 10.67 ms │    no change │
│ QQuery 45 │           44.06 / 44.45 ±0.26 / 44.83 ms │           43.68 / 43.85 ±0.17 / 44.18 ms │    no change │
│ QQuery 46 │              8.26 / 8.42 ±0.15 / 8.71 ms │              8.48 / 8.64 ±0.16 / 8.92 ms │    no change │
│ QQuery 47 │        670.12 / 679.19 ±6.03 / 686.25 ms │        670.79 / 675.04 ±4.77 / 681.42 ms │    no change │
│ QQuery 48 │        273.79 / 277.22 ±2.72 / 282.13 ms │        272.72 / 275.63 ±2.98 / 280.85 ms │    no change │
│ QQuery 49 │        243.29 / 246.26 ±4.15 / 254.40 ms │        242.67 / 244.24 ±1.49 / 246.95 ms │    no change │
│ QQuery 50 │        183.90 / 186.09 ±3.18 / 192.41 ms │        184.36 / 187.91 ±2.47 / 191.90 ms │    no change │
│ QQuery 51 │        169.14 / 172.36 ±3.77 / 179.45 ms │        169.62 / 173.86 ±4.28 / 181.94 ms │    no change │
│ QQuery 52 │        105.52 / 108.30 ±2.49 / 112.84 ms │        107.35 / 109.33 ±3.29 / 115.82 ms │    no change │
│ QQuery 53 │        101.94 / 102.54 ±0.41 / 103.16 ms │        101.90 / 102.26 ±0.25 / 102.61 ms │    no change │
│ QQuery 54 │        143.44 / 145.46 ±2.64 / 150.59 ms │        142.46 / 145.43 ±2.23 / 148.93 ms │    no change │
│ QQuery 55 │        105.56 / 106.22 ±0.51 / 106.91 ms │        106.00 / 106.66 ±0.63 / 107.74 ms │    no change │
│ QQuery 56 │        138.12 / 139.57 ±2.03 / 143.45 ms │        138.02 / 139.60 ±1.17 / 141.34 ms │    no change │
│ QQuery 57 │        163.36 / 165.23 ±1.89 / 168.63 ms │        162.87 / 164.69 ±1.47 / 166.65 ms │    no change │
│ QQuery 58 │        241.22 / 242.17 ±0.86 / 243.78 ms │        240.87 / 243.91 ±2.03 / 246.97 ms │    no change │
│ QQuery 59 │        192.36 / 193.98 ±1.74 / 197.10 ms │        192.25 / 193.92 ±1.81 / 197.36 ms │    no change │
│ QQuery 60 │        139.97 / 140.93 ±0.85 / 142.17 ms │        138.84 / 140.17 ±1.12 / 141.82 ms │    no change │
│ QQuery 61 │           13.12 / 13.30 ±0.20 / 13.69 ms │           13.41 / 13.51 ±0.17 / 13.86 ms │    no change │
│ QQuery 62 │        844.39 / 853.54 ±6.31 / 863.40 ms │        846.21 / 854.60 ±4.77 / 859.77 ms │    no change │
│ QQuery 63 │        101.47 / 102.88 ±1.22 / 105.13 ms │        101.26 / 102.00 ±0.60 / 103.02 ms │    no change │
│ QQuery 64 │        621.66 / 625.58 ±3.32 / 630.79 ms │        622.73 / 627.77 ±4.69 / 636.25 ms │    no change │
│ QQuery 65 │        237.58 / 240.14 ±2.79 / 244.88 ms │        238.87 / 241.70 ±2.32 / 244.91 ms │    no change │
│ QQuery 66 │        211.61 / 217.56 ±4.45 / 225.36 ms │        211.52 / 219.53 ±7.88 / 232.84 ms │    no change │
│ QQuery 67 │        286.65 / 290.81 ±4.25 / 298.91 ms │        286.22 / 292.85 ±8.27 / 308.40 ms │    no change │
│ QQuery 68 │              8.52 / 8.78 ±0.27 / 9.29 ms │              8.68 / 8.86 ±0.27 / 9.39 ms │    no change │
│ QQuery 69 │           97.42 / 98.06 ±0.47 / 98.66 ms │           97.83 / 98.62 ±0.51 / 99.14 ms │    no change │
│ QQuery 70 │        314.43 / 317.82 ±3.70 / 323.33 ms │        318.21 / 322.40 ±4.12 / 330.15 ms │    no change │
│ QQuery 71 │        132.28 / 135.66 ±4.94 / 145.50 ms │        132.08 / 135.75 ±3.51 / 140.09 ms │    no change │
│ QQuery 72 │        532.24 / 539.83 ±4.56 / 546.00 ms │        527.04 / 536.94 ±7.45 / 545.05 ms │    no change │
│ QQuery 73 │              6.75 / 6.88 ±0.22 / 7.31 ms │              6.60 / 6.75 ±0.21 / 7.16 ms │    no change │
│ QQuery 74 │        522.26 / 535.23 ±8.89 / 547.88 ms │        527.20 / 539.17 ±7.24 / 546.98 ms │    no change │
│ QQuery 75 │        265.18 / 267.86 ±2.52 / 272.59 ms │        262.37 / 265.73 ±2.39 / 269.67 ms │    no change │
│ QQuery 76 │        128.58 / 129.83 ±0.94 / 131.48 ms │        128.71 / 129.77 ±1.53 / 132.80 ms │    no change │
│ QQuery 77 │        186.63 / 187.97 ±1.23 / 190.29 ms │        185.66 / 186.61 ±0.77 / 187.63 ms │    no change │
│ QQuery 78 │        309.51 / 311.84 ±1.82 / 315.05 ms │        303.81 / 305.59 ±1.54 / 308.26 ms │    no change │
│ QQuery 79 │        227.76 / 229.20 ±1.60 / 232.21 ms │        226.26 / 228.68 ±2.09 / 232.26 ms │    no change │
│ QQuery 80 │        299.58 / 301.83 ±1.75 / 304.97 ms │        298.71 / 301.39 ±2.68 / 306.49 ms │    no change │
│ QQuery 81 │           25.31 / 25.65 ±0.30 / 26.16 ms │           25.84 / 26.22 ±0.38 / 26.92 ms │    no change │
│ QQuery 82 │           38.99 / 39.47 ±0.35 / 39.93 ms │           38.83 / 39.15 ±0.22 / 39.37 ms │    no change │
│ QQuery 83 │           35.18 / 35.33 ±0.09 / 35.42 ms │           34.66 / 35.04 ±0.30 / 35.53 ms │    no change │
│ QQuery 84 │           46.25 / 46.36 ±0.08 / 46.49 ms │           45.40 / 45.75 ±0.21 / 46.05 ms │    no change │
│ QQuery 85 │        139.41 / 140.94 ±2.01 / 144.71 ms │        140.64 / 141.10 ±0.51 / 142.07 ms │    no change │
│ QQuery 86 │           36.58 / 37.20 ±0.52 / 38.02 ms │           36.68 / 36.88 ±0.12 / 37.07 ms │    no change │
│ QQuery 87 │              3.50 / 3.60 ±0.09 / 3.74 ms │              3.51 / 3.58 ±0.10 / 3.77 ms │    no change │
│ QQuery 88 │         98.49 / 102.62 ±6.34 / 115.25 ms │         99.58 / 101.17 ±2.82 / 106.79 ms │    no change │
│ QQuery 89 │        116.45 / 117.05 ±0.54 / 117.76 ms │        115.56 / 116.62 ±0.62 / 117.44 ms │    no change │
│ QQuery 90 │           22.12 / 22.50 ±0.40 / 23.19 ms │           22.20 / 22.41 ±0.19 / 22.74 ms │    no change │
│ QQuery 91 │           58.13 / 59.47 ±1.38 / 61.97 ms │           58.11 / 59.08 ±0.51 / 59.56 ms │    no change │
│ QQuery 92 │           55.24 / 55.81 ±0.38 / 56.34 ms │           55.63 / 56.01 ±0.44 / 56.70 ms │    no change │
│ QQuery 93 │        161.13 / 162.49 ±1.35 / 165.05 ms │        159.20 / 160.46 ±0.84 / 161.42 ms │    no change │
│ QQuery 94 │           59.95 / 60.42 ±0.38 / 60.96 ms │           60.69 / 60.95 ±0.18 / 61.20 ms │    no change │
│ QQuery 95 │        110.23 / 110.83 ±0.39 / 111.33 ms │        109.25 / 110.27 ±0.57 / 110.74 ms │    no change │
│ QQuery 96 │           67.76 / 68.80 ±0.83 / 70.18 ms │           67.30 / 68.43 ±1.10 / 69.78 ms │    no change │
│ QQuery 97 │        111.63 / 112.65 ±0.75 / 113.65 ms │        111.27 / 113.64 ±2.79 / 118.83 ms │    no change │
│ QQuery 98 │        149.29 / 150.05 ±0.55 / 150.87 ms │        148.18 / 149.69 ±1.25 / 151.21 ms │    no change │
│ QQuery 99 │ 10688.52 / 10763.02 ±66.04 / 10854.06 ms │ 10677.81 / 10786.08 ±99.83 / 10926.80 ms │    no change │
└───────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴──────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                                   ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                                   │ 29617.14ms │
│ Total Time (groupjoin-eliminate-extra-hash-build)   │ 29649.63ms │
│ Average Time (HEAD)                                 │   299.16ms │
│ Average Time (groupjoin-eliminate-extra-hash-build) │   299.49ms │
│ Queries Faster                                      │          0 │
│ Queries Slower                                      │          1 │
│ Queries with No Change                              │         98 │
│ Queries with Failure                                │          0 │
└─────────────────────────────────────────────────────┴────────────┘

Resource Usage

tpcds — base (merge-base)

Metric Value
Wall time 150.0s
Peak memory 6.2 GiB
Avg memory 5.7 GiB
CPU user 234.5s
CPU sys 7.3s
Peak spill 0 B

tpcds — branch

Metric Value
Wall time 150.0s
Peak memory 6.5 GiB
Avg memory 5.7 GiB
CPU user 234.6s
CPU sys 7.5s
Peak spill 0 B

File an issue against this benchmark runner

@github-actions github-actions Bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) proto Related to proto crate labels May 3, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

Thank you for opening this pull request!

Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).

Details
     Cloning origin/main
    Building datafusion v53.1.0 (current)
       Built [  84.818s] (current)
     Parsing datafusion v53.1.0 (current)
      Parsed [   0.035s] (current)
    Building datafusion v53.1.0 (baseline)
       Built [  83.465s] (baseline)
     Parsing datafusion v53.1.0 (baseline)
      Parsed [   0.035s] (baseline)
    Checking datafusion v53.1.0 -> v53.1.0 (no change; assume patch)
     Checked [   0.616s] 222 checks: 222 pass, 30 skip
     Summary no semver update required
    Finished [ 170.709s] datafusion
    Building datafusion-physical-optimizer v53.1.0 (current)
       Built [  38.351s] (current)
     Parsing datafusion-physical-optimizer v53.1.0 (current)
      Parsed [   0.022s] (current)
    Building datafusion-physical-optimizer v53.1.0 (baseline)
       Built [  38.253s] (baseline)
     Parsing datafusion-physical-optimizer v53.1.0 (baseline)
      Parsed [   0.021s] (baseline)
    Checking datafusion-physical-optimizer v53.1.0 -> v53.1.0 (no change; assume patch)
     Checked [   0.106s] 222 checks: 222 pass, 30 skip
     Summary no semver update required
    Finished [  79.387s] datafusion-physical-optimizer
    Building datafusion-physical-plan v53.1.0 (current)
       Built [  33.351s] (current)
     Parsing datafusion-physical-plan v53.1.0 (current)
      Parsed [   0.127s] (current)
    Building datafusion-physical-plan v53.1.0 (baseline)
       Built [  33.074s] (baseline)
     Parsing datafusion-physical-plan v53.1.0 (baseline)
      Parsed [   0.122s] (baseline)
    Checking datafusion-physical-plan v53.1.0 -> v53.1.0 (no change; assume patch)
     Checked [   0.573s] 222 checks: 222 pass, 30 skip
     Summary no semver update required
    Finished [  69.319s] datafusion-physical-plan
    Building datafusion-proto v53.1.0 (current)
       Built [  55.546s] (current)
     Parsing datafusion-proto v53.1.0 (current)
      Parsed [   0.132s] (current)
    Building datafusion-proto v53.1.0 (baseline)
       Built [  55.206s] (baseline)
     Parsing datafusion-proto v53.1.0 (baseline)
      Parsed [   0.135s] (baseline)
    Checking datafusion-proto v53.1.0 -> v53.1.0 (no change; assume patch)
     Checked [   1.614s] 222 checks: 221 pass, 1 fail, 0 warn, 30 skip

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/enum_variant_added.ron

Failed in:
  variant PhysicalPlanType:GroupJoin in /home/runner/work/datafusion/datafusion/datafusion/proto/src/generated/prost.rs:1209
  variant PhysicalPlanType:GroupJoin in /home/runner/work/datafusion/datafusion/datafusion/proto/src/generated/prost.rs:1209

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [ 115.452s] datafusion-proto
    Building datafusion-sqllogictest v53.1.0 (current)
       Built [ 136.999s] (current)
     Parsing datafusion-sqllogictest v53.1.0 (current)
      Parsed [   0.021s] (current)
    Building datafusion-sqllogictest v53.1.0 (baseline)
       Built [ 136.464s] (baseline)
     Parsing datafusion-sqllogictest v53.1.0 (baseline)
      Parsed [   0.023s] (baseline)
    Checking datafusion-sqllogictest v53.1.0 -> v53.1.0 (no change; assume patch)
     Checked [   0.092s] 222 checks: 222 pass, 30 skip
     Summary no semver update required
    Finished [ 276.490s] datafusion-sqllogictest

@nathanb9
Copy link
Copy Markdown
Contributor Author

nathanb9 commented May 3, 2026

@Dandandan Thanks for running the benchmarks.

There are additional equivalencies/optimizations of hashjoin + groupby that can be turned into groupjoin from the paper. I wanted to make this PR just the initial optimization + create the groupjoin rule.

If its okay, I will ping you in another draft PR which will contain all optimizations in the paper so you can review + benchmark.

I listed the optimizations im talking about at the bottom of this PRs description. Ignore the cost based one I think this is not really currently applicable

@Dandandan
Copy link
Copy Markdown
Contributor

@Dandandan Thanks for running the benchmarks.

There are additional equivalencies/optimizations of hashjoin + groupby that can be turned into groupjoin from the paper. I wanted to make this PR just the initial optimization + create the groupjoin rule.

If its okay, I will ping you in another draft PR which will contain all optimizations in the paper so you can review + benchmark.

I listed the optimizations im talking about at the bottom of this PRs description. Ignore the cost based one I think this is not really currently applicable

Sounds great!

@2010YOUY01
Copy link
Copy Markdown
Contributor

This looks awesome!

I have a question, why physical optimizer rule? It looks simpler to implement a logical optimizer rule instead.

@nathanb9
Copy link
Copy Markdown
Contributor Author

nathanb9 commented May 5, 2026

@2010YOUY01 So introduce the groupjoin logically by detecting the opportunity there then edit the hash join exec so that it does the goupby within?

@2010YOUY01
Copy link
Copy Markdown
Contributor

@2010YOUY01 So introduce the groupjoin logically by detecting the opportunity there then edit the hash join exec so that it does the goupby within?

On second thought, I figured it’s better to keep this in the physical optimizer, please ignore that.

If we perform this transformation in the logical optimizer (by detecting Aggregate + equi-join), we remove the flexibility for the physical optimizer to choose among multiple applicable rules (that are only possible in physical optimizer) and search for a globally optimal plan.

@nathanb9
Copy link
Copy Markdown
Contributor Author

nathanb9 commented May 6, 2026

sounds good, thanks. Yep, physical rule preferred because there is some complexity on additional groupjoins optimizations possible which im not sure is possible just in logical layer

When groupjoin opportunity is found we always do the Memoizing GroupJoin so simply build the hash table on the left side with accumulators embedded, then update them inplace during probe.
Then with its own physical plan we do additional optimization like for example:

One big one from the papers is "Eager Right Aggregation" which is just pre-aggregate the probe side before the join, reducing its cardinality from |S| to |distinct(S.join_key)|. Ideal when most right-side groups have a corresponding value (one way to verify this is foreign key constraint which can be added with eager aggregation)

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

Labels

core Core DataFusion crate optimizer Optimizer rules physical-plan Changes to the physical-plan crate proto Related to proto crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants