dongjoon-hyun opened a new pull request, #60508:
URL: https://github.com/apache/spark/pull/60508

   ### What changes were proposed in this pull request?
   
   This PR aims to backport #60491 to `branch-4.x`.
   
   It adds `RowLevelOperationBenchmark`, which measures the analysis of DSv2 
row-level operations on wide tables. The analyzer rewrites `DELETE`, `UPDATE` 
and `MERGE` into `ReplaceData` for a group-based table and into `WriteDelta` 
for a delta-based table. The benchmark analyzes the following statements.
   
   - `UPDATE t SET c_1 = -1 WHERE pk = 1` on group-based and delta-based tables
   - `DELETE FROM t WHERE pk = 1` on a group-based table
   - `MERGE INTO t USING source s ON t.pk = s.pk WHEN MATCHED THEN UPDATE SET 
c_1 = s.v` on group-based and delta-based tables
   
   Each table is `pk INT NOT NULL, c_1 INT, ..., c_N INT, dep STRING` 
partitioned by `dep`, where `N` is 100, 1,000 or 10,000. The tables are created 
in `InMemoryRowLevelOperationTableCatalog`, and the delta-based ones have 
`'supports-deltas' = 'true'`. `source` is a one-row temporary view. Each 
iteration parses the statement and calls `spark.sessionState.executePlan(plan, 
CommandExecutionMode.SKIP).analyzed`, so the statement is not optimized, 
planned or executed.
   
   ### Why are the changes needed?
   
   To measure the analysis cost of DSv2 row-level operations on wide tables in 
`branch-4.x` too. Please note that this is a baseline to compare the future 
update.
   
   The row-level rewrite rules (`RewriteDeleteFromTable`, `RewriteUpdateTable` 
and `RewriteMergeIntoTable`), `ResolveRowLevelCommandAssignments` and 
`InMemoryRowLevelOperationTable` are identical in `master` and `branch-4.x`, so 
this benchmark measures the same code paths in both branches.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This is a test-only change.
   
   ### How was this patch tested?
   
   Benchmark-only change.
   
   ```
   build/sbt "sql/Test/runMain 
org.apache.spark.sql.execution.benchmark.RowLevelOperationBenchmark"
   ```
   
   Unlike `master`, `branch-4.x` uses Java 17 as the base version of the 
benchmark results files because it does not have SPARK-60831 (#60046). So the 
results files are not cherry-picked from `master`. Instead, 
`RowLevelOperationBenchmark-results.txt` (JDK 17), 
`RowLevelOperationBenchmark-jdk21-results.txt` (JDK 21) and 
`RowLevelOperationBenchmark-jdk25-results.txt` (JDK 25) are generated with the 
GitHub Actions `benchmark.yml` workflow on `AMD EPYC 7763` for `branch-4.x`. 
The following table shows the `Best Time(ms)` of the `10000 columns` cases.
   
   | Benchmark | JDK 17 | JDK 21 | JDK 25 |
   |---|--:|--:|--:|
   | analyze group-based UPDATE | TBD | TBD | TBD |
   | analyze delta-based UPDATE | TBD | TBD | TBD |
   | analyze group-based DELETE | TBD | TBD | TBD |
   | analyze group-based MERGE | TBD | TBD | TBD |
   | analyze delta-based MERGE | TBD | TBD | TBD |
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to