You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2026/09/28 17:57:45 UTC

(spark) branch branch-4.x updated: [SPARK-59713][4.X][SQL][TEST] Add a large-group case to `AsOfJoinBenchmark`

This is an automated email from the ASF dual-hosted git repository.

dongjoon-hyun pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new d4cd1cdb3582 [SPARK-59713][4.X][SQL][TEST] Add a large-group case to `AsOfJoinBenchmark`
d4cd1cdb3582 is described below

commit d4cd1cdb35829206c85ee5e7bbc3b53458cddaa1
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Mon Sep 28 10:57:33 2026 -0700

    [SPARK-59713][4.X][SQL][TEST] Add a large-group case to `AsOfJoinBenchmark`
    
    ### What changes were proposed in this pull request?
    
    This PR adds a third shape to `AsOfJoinBenchmark`: 10K x 10K rows over **10** equi-key groups,
    between the existing `groups=100` and no-equi-key cases. `asOfJoinBenchmark` already takes
    `numGroups`, so this is purely a new invocation.
    
    ### Why are the changes needed?
    
    `SortMergeAsOfJoinScanner` buffers the right-side rows of an equi-key group and rescans that
    buffer once per left row, so the scan cost per left row grows with the group size. Neither
    existing case covers that: `groups=100` buffers only ~100 right rows per group, where the scan is
    swamped by the shuffle and the sort, and the no-equi-key case takes a different planning path
    (`AllTuples` distribution, `bufferAllRight` instead of `bufferRightGroup`).
    
    `groups=10` buffers ~1000 right rows per group on the ordinary equi-key path, making changes to
    the scan measurable.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No. This is a test-only change to a benchmark class.
    
    ### How was this patch tested?
    
    Benchmark-only change.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Opus 5
    
    Closes #59104 from dongjoon-hyun/SPARK-59713-4.x.
    
    Authored-by: Dongjoon Hyun <do...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 .../benchmarks/AsOfJoinBenchmark-jdk21-results.txt    | 19 +++++++++++++------
 .../benchmarks/AsOfJoinBenchmark-jdk25-results.txt    | 19 +++++++++++++------
 sql/core/benchmarks/AsOfJoinBenchmark-results.txt     | 19 +++++++++++++------
 .../sql/execution/benchmark/AsOfJoinBenchmark.scala   |  3 +++
 4 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/sql/core/benchmarks/AsOfJoinBenchmark-jdk21-results.txt b/sql/core/benchmarks/AsOfJoinBenchmark-jdk21-results.txt
index 2fc4e230fd60..6b2620e14ef8 100644
--- a/sql/core/benchmarks/AsOfJoinBenchmark-jdk21-results.txt
+++ b/sql/core/benchmarks/AsOfJoinBenchmark-jdk21-results.txt
@@ -2,18 +2,25 @@
 AS-OF Join Benchmark
 ================================================================================================
 
-OpenJDK 64-Bit Server VM 21.0.11+10-LTS on Linux 6.17.0-1018-azure
+OpenJDK 64-Bit Server VM 21.0.12+8-LTS on Linux 6.17.0-1022-azure
 AMD EPYC 7763 64-Core Processor
 AS-OF Join (left=10000, right=10000, groups=100):  Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 --------------------------------------------------------------------------------------------------------------------------------
-Correlated subquery (baseline)                            38299          38496         279          0.0     3829864.5       1.0X
-Sort-merge AS-OF join                                        68             92          13          0.1        6813.3     562.1X
+Correlated subquery (baseline)                            37512          37670         223          0.0     3751200.6       1.0X
+Sort-merge AS-OF join                                        56             79          17          0.2        5646.2     664.4X
 
-OpenJDK 64-Bit Server VM 21.0.11+10-LTS on Linux 6.17.0-1018-azure
+OpenJDK 64-Bit Server VM 21.0.12+8-LTS on Linux 6.17.0-1022-azure
+AMD EPYC 7763 64-Core Processor
+AS-OF Join (left=10000, right=10000, groups=10):  Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
+-------------------------------------------------------------------------------------------------------------------------------
+Correlated subquery (baseline)                           38859          39083         316          0.0     3885945.5       1.0X
+Sort-merge AS-OF join                                      134            153          14          0.1       13400.5     290.0X
+
+OpenJDK 64-Bit Server VM 21.0.12+8-LTS on Linux 6.17.0-1022-azure
 AMD EPYC 7763 64-Core Processor
 AS-OF Join no equi-key (left=10000, right=10000):  Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 --------------------------------------------------------------------------------------------------------------------------------
-Correlated subquery (baseline)                            24733          24827         133          0.0     2473327.2       1.0X
-Sort-merge AS-OF join                                      1570           1581          16          0.0      156990.6      15.8X
+Correlated subquery (baseline)                            24135          24198          90          0.0     2413476.8       1.0X
+Sort-merge AS-OF join                                       948            957           8          0.0       94829.4      25.5X
 
 
diff --git a/sql/core/benchmarks/AsOfJoinBenchmark-jdk25-results.txt b/sql/core/benchmarks/AsOfJoinBenchmark-jdk25-results.txt
index 46fcdaeeb771..d24862a01e7f 100644
--- a/sql/core/benchmarks/AsOfJoinBenchmark-jdk25-results.txt
+++ b/sql/core/benchmarks/AsOfJoinBenchmark-jdk25-results.txt
@@ -2,18 +2,25 @@
 AS-OF Join Benchmark
 ================================================================================================
 
-OpenJDK 64-Bit Server VM 25.0.3+9-LTS on Linux 6.17.0-1018-azure
+OpenJDK 64-Bit Server VM 25.0.4+7-LTS on Linux 6.17.0-1022-azure
 AMD EPYC 7763 64-Core Processor
 AS-OF Join (left=10000, right=10000, groups=100):  Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 --------------------------------------------------------------------------------------------------------------------------------
-Correlated subquery (baseline)                            40197          40231          47          0.0     4019717.4       1.0X
-Sort-merge AS-OF join                                        61             89          15          0.2        6093.4     659.7X
+Correlated subquery (baseline)                            39669          39714          65          0.0     3966851.1       1.0X
+Sort-merge AS-OF join                                        51             69          11          0.2        5147.4     770.7X
 
-OpenJDK 64-Bit Server VM 25.0.3+9-LTS on Linux 6.17.0-1018-azure
+OpenJDK 64-Bit Server VM 25.0.4+7-LTS on Linux 6.17.0-1022-azure
+AMD EPYC 7763 64-Core Processor
+AS-OF Join (left=10000, right=10000, groups=10):  Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
+-------------------------------------------------------------------------------------------------------------------------------
+Correlated subquery (baseline)                           38551          38612          86          0.0     3855093.8       1.0X
+Sort-merge AS-OF join                                      113            126          11          0.1       11329.9     340.3X
+
+OpenJDK 64-Bit Server VM 25.0.4+7-LTS on Linux 6.17.0-1022-azure
 AMD EPYC 7763 64-Core Processor
 AS-OF Join no equi-key (left=10000, right=10000):  Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 --------------------------------------------------------------------------------------------------------------------------------
-Correlated subquery (baseline)                            23803          23818          21          0.0     2380348.1       1.0X
-Sort-merge AS-OF join                                      1585           1602          24          0.0      158493.5      15.0X
+Correlated subquery (baseline)                            23087          23184         137          0.0     2308693.2       1.0X
+Sort-merge AS-OF join                                       871            881           9          0.0       87066.5      26.5X
 
 
diff --git a/sql/core/benchmarks/AsOfJoinBenchmark-results.txt b/sql/core/benchmarks/AsOfJoinBenchmark-results.txt
index 60edcb2743e5..0fac03d79f5c 100644
--- a/sql/core/benchmarks/AsOfJoinBenchmark-results.txt
+++ b/sql/core/benchmarks/AsOfJoinBenchmark-results.txt
@@ -2,18 +2,25 @@
 AS-OF Join Benchmark
 ================================================================================================
 
-OpenJDK 64-Bit Server VM 17.0.19+10-LTS on Linux 6.17.0-1018-azure
+OpenJDK 64-Bit Server VM 17.0.20+8-LTS on Linux 6.17.0-1022-azure
 AMD EPYC 7763 64-Core Processor
 AS-OF Join (left=10000, right=10000, groups=100):  Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 --------------------------------------------------------------------------------------------------------------------------------
-Correlated subquery (baseline)                            37910          37980          99          0.0     3790977.0       1.0X
-Sort-merge AS-OF join                                        53             65           9          0.2        5264.7     720.1X
+Correlated subquery (baseline)                            38244          38338         132          0.0     3824399.2       1.0X
+Sort-merge AS-OF join                                        48             61          10          0.2        4769.2     801.9X
 
-OpenJDK 64-Bit Server VM 17.0.19+10-LTS on Linux 6.17.0-1018-azure
+OpenJDK 64-Bit Server VM 17.0.20+8-LTS on Linux 6.17.0-1022-azure
+AMD EPYC 7763 64-Core Processor
+AS-OF Join (left=10000, right=10000, groups=10):  Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
+-------------------------------------------------------------------------------------------------------------------------------
+Correlated subquery (baseline)                           38155          38174          27          0.0     3815547.8       1.0X
+Sort-merge AS-OF join                                      118            124           4          0.1       11830.2     322.5X
+
+OpenJDK 64-Bit Server VM 17.0.20+8-LTS on Linux 6.17.0-1022-azure
 AMD EPYC 7763 64-Core Processor
 AS-OF Join no equi-key (left=10000, right=10000):  Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 --------------------------------------------------------------------------------------------------------------------------------
-Correlated subquery (baseline)                            23421          23429          11          0.0     2342088.5       1.0X
-Sort-merge AS-OF join                                      1399           1402           4          0.0      139932.2      16.7X
+Correlated subquery (baseline)                            24596          24641          63          0.0     2459626.1       1.0X
+Sort-merge AS-OF join                                       865            869           6          0.0       86493.4      28.4X
 
 
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AsOfJoinBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AsOfJoinBenchmark.scala
index 2d1a18b1d6bd..b17dc5ef8644 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AsOfJoinBenchmark.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/AsOfJoinBenchmark.scala
@@ -125,6 +125,9 @@ object AsOfJoinBenchmark extends SqlBasedBenchmark {
     runBenchmark("AS-OF Join Benchmark") {
       // 10K left x 10K right, 100 groups - both paths feasible
       asOfJoinBenchmark(leftRows = 10000, rightRows = 10000, numGroups = 100)
+      // Few large groups: ~1K right rows buffered per group, and each left row rescans a
+      // prefix of that buffer, which is where the per-left-row group-scan cost dominates.
+      asOfJoinBenchmark(leftRows = 10000, rightRows = 10000, numGroups = 10)
       // No equi-key: 10K x 10K
       asOfJoinNoEquiKeyBenchmark(leftRows = 10000, rightRows = 10000)
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org