Skip to content

minor: Refactor expression microbenchmarks to remove duplicate code - #2956

Merged
andygrove merged 5 commits into
apache:mainfrom
andygrove:refactor-expression-benchmarks
Dec 22, 2025
Merged

andygrove merged 5 commits into
apache:mainfrom
andygrove:refactor-expression-benchmarks

Conversation

@andygrove

@andygrove andygrove commented Dec 22, 2025 •

Copy link
Copy Markdown
Member

Which issue does this PR close?

Part of #2955

Rationale for this change

Each expression microbenchmark repeats the following code, but with differences in naming:

        benchmark.addCase("SQL Parquet - Spark") { _ =>


          spark.sql(query).noop()
        }

        benchmark.addCase("SQL Parquet - Comet (Scan)") { _ =>
          withSQLConf(CometConf.COMET_ENABLED.key -> "true") {
            spark.sql(query).noop()
          }
        }

        benchmark.addCase("SQL Parquet - Comet (Scan, Exec)") { _ =>
          withSQLConf(
            CometConf.COMET_ENABLED.key -> "true",
            CometConf.COMET_EXEC_ENABLED.key -> "true") {
            spark.sql(query).noop()
          }
        }

This PR moves this logic into a base class and re-uses it across all existing expression microbenchmarks.

What changes are included in this PR?

How are these changes tested?

@andygrove
andygrove marked this pull request as ready for review December 22, 2025 16:47
@andygrove

Copy link
Copy Markdown
Member Author

@coderfender could you review?

withSQLConf(CometConf.COMET_ENABLED.key -> "true") {
spark.sql(query).noop()
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor : Would we be needing exec and scan exec for all types of benchmarks @andygrove ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I only updated expression benchmarks in this PR but will follow up for the other ones (shuffle, exec, aggregate) in separate PRs in the future but those ones are a little more involved. My short term goal is to add benchmarks for all expressions, so wanted to refactor the expression benchmarks before doing that.

@coderfender

Copy link
Copy Markdown
Contributor

Might want to fix unused imports to pass CI

@codecov-commenter

codecov-commenter commented Dec 22, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.60%. Comparing base (f09f8af) to head (7034e27).
⚠️ Report is 789 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2956      +/-   ##
============================================
+ Coverage     56.12%   59.60%   +3.47%     
- Complexity      976     1381     +405     
============================================
  Files           119      167      +48     
  Lines         11743    15493    +3750     
  Branches       2251     2568     +317     
============================================
+ Hits           6591     9234    +2643     
- Misses         4012     4959     +947     
- Partials       1140     1300     +160     

☔ View full report in Codecov by Sentry.
📢 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.

@andygrove
andygrove requested a review from comphead December 22, 2025 20:55

@comphead comphead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andygrove nice clean up

Image

@andygrove
andygrove merged commit f458088 into apache:main Dec 22, 2025
135 of 136 checks passed
@andygrove
andygrove deleted the refactor-expression-benchmarks branch December 22, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants