Skip to content

Expand Beam SQL TPC-DS query support and add Python TPC-DS suite - #40695

Merged
Abacn merged 2 commits into
apache:masterfrom
Abacn:tpcds-py
Oct 22, 2026
Merged

Abacn merged 2 commits into
apache:masterfrom
Abacn:tpcds-py

Conversation

@Abacn

@Abacn Abacn commented Oct 20, 2026

Copy link
Copy Markdown
Contributor
  • Add BeamCrossJoinRel and BeamCrossJoinRule to support bounded-by-bounded pure cross joins in Beam Calcite SQL.
  • Extend BeamCoGBKJoinRule to split mixed equi/non-equi inner join predicates into an equi-join followed by a post-join BeamCalcRel filter.
  • Support LAG, LEAD, FIRST_VALUE, LAST_VALUE, NTH_VALUE (RESPECT/IGNORE NULLS), and CUME_DIST analytic window functions in BeamWindowRel and BeamBuiltinAnalyticFunctions, and convert window inputs to BeamLogicalConvention in BeamWindowRule.
  • Fix NULLS FIRST and NULLS LAST comparator ordering in BeamSortRel when combined with ASC/DESC.
  • Normalize set operator (UNION, INTERSECT, EXCEPT) input schemas in BeamSetOperatorRelBase when inputs differ only by field names or nullability.
  • Return NULL instead of 0.0 from VarianceFn for empty or single-element sample variance/stddev groups to match SQL standard semantics.
  • Remove workarounds in TPC-DS table schemas used to cast DECIMAL to DOUBLE for fractional columns

Having these improvements, 55 out of 103 queries now passing (up from 24). Then for test suite,

  • add --queries=supported and 10M/10MB dataset size support to TpcdsParametersReader.
  • Add the Python TPC-DS benchmark and regression test suite (sdks/python/apache_beam/testing/benchmarks/tpcds) running on PrismRunner and cross-language SqlTransform.
  • Update Java TPC-DS GitHub Actions workflows to use --queries=supported and add the beam_PostCommit_Python_Tpcds_Prism.yml workflow.

with:
persist-credentials: false
- name: Setup repository
uses: ./.github/actions/setup-action
- name: Setup repository
uses: ./.github/actions/setup-action
- name: Setup environment
uses: ./.github/actions/setup-environment-action
python-version: default
go-version: default
- name: Run full TPC-DS suite on PrismRunner with regression check
uses: ./.github/actions/gradle-command-self-hosted-action
- Add `BeamCrossJoinRel` and `BeamCrossJoinRule` to support bounded-by-bounded pure cross joins in Beam Calcite SQL.
- Extend `BeamCoGBKJoinRule` to split mixed equi/non-equi inner join predicates into an equi-join followed by a post-join `BeamCalcRel` filter.
- Support `LAG`, `LEAD`, `FIRST_VALUE`, `LAST_VALUE`, `NTH_VALUE` (`RESPECT`/`IGNORE NULLS`), and `CUME_DIST` analytic window functions in `BeamWindowRel` and `BeamBuiltinAnalyticFunctions`, and convert window inputs to `BeamLogicalConvention` in `BeamWindowRule`.
- Fix `NULLS FIRST` and `NULLS LAST` comparator ordering in `BeamSortRel` when combined with `ASC`/`DESC`.
- Normalize set operator (`UNION`, `INTERSECT`, `EXCEPT`) input schemas in `BeamSetOperatorRelBase` when inputs differ only by field names or nullability.
- Return `NULL` instead of `0.0` from `VarianceFn` for empty or single-element sample variance/stddev groups to match SQL standard semantics.
- Remove workarounds in TPC-DS table schemas used to cast `DECIMAL` to `DOUBLE` for fractional columns

Having these improvements, 55 out of 103 queries now passing (up from 24). Then for test suite,

- add `--queries=supported` and `10M`/`10MB` dataset size support to `TpcdsParametersReader`.
- Add the Python TPC-DS benchmark and regression test suite (`sdks/python/apache_beam/testing/benchmarks/tpcds`) running on `PrismRunner` and cross-language `SqlTransform`.
- Update Java TPC-DS GitHub Actions workflows to use `--queries=supported` and add the `beam_PostCommit_Python_Tpcds_Prism.yml` workflow.
- Move query result file to a temp bucket with lifecycle policy, prevent resource leak
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.49741% with 359 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.42%. Comparing base (76f6e6d) to head (baa179f).
⚠️ Report is 280 commits behind head on master.

Files with missing lines Patch % Lines
...he_beam/testing/benchmarks/tpcds/tpcds_launcher.py 29.80% 146 Missing ⚠️
...che_beam/testing/benchmarks/tpcds/tpcds_schemas.py 39.50% 49 Missing ⚠️
...xtensions/sql/impl/rel/BeamSetOperatorRelBase.java 18.75% 37 Missing and 2 partials ⚠️
...l/impl/transform/BeamBuiltinAnalyticFunctions.java 33.96% 32 Missing and 3 partials ⚠️
...eam/sdk/extensions/sql/impl/rel/BeamWindowRel.java 34.88% 23 Missing and 5 partials ⚠️
...che_beam/testing/benchmarks/tpcds/tpcds_queries.py 68.11% 22 Missing ⚠️
.../sdk/extensions/sql/impl/rel/BeamCrossJoinRel.java 72.72% 9 Missing and 6 partials ⚠️
...dk/extensions/sql/impl/rule/BeamCoGBKJoinRule.java 81.15% 4 Missing and 9 partials ⚠️
...dk/extensions/sql/impl/rule/BeamCrossJoinRule.java 84.61% 1 Missing and 3 partials ⚠️
...ns/sql/impl/transform/BeamBuiltinAggregations.java 33.33% 2 Missing and 2 partials ⚠️
... and 3 more
Additional details and impacted files
@@              Coverage Diff              @@
##             master   #40695       +/-   ##
=============================================
+ Coverage     56.16%   77.42%   +21.25%     
- Complexity     2288     2359       +71     
=============================================
  Files          1124      814      -310     
  Lines        178336    98969    -79367     
  Branches       1489     2029      +540     
=============================================
- Hits         100170    76629    -23541     
+ Misses        75645    21573    -54072     
+ Partials       2521      767     -1754     
Flag Coverage Δ
go ?
java 64.19% <65.70%> (-11.59%) ⬇️
python 79.90% <39.38%> (+0.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@Abacn
Abacn marked this pull request as ready for review October 20, 2026 23:36
@github-actions

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@Abacn

Abacn commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

PreCommit SQL Java17 failing errorprone in HEAD, not related to this change

@Abacn

Abacn commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

R: @kennknowles

@github-actions

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@kennknowles kennknowles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems really useful. LGTM modulo a few comments. Hopefully easy to automate clean up.

@Override
public BeamCostModel beamComputeSelfCost(RelOptPlanner planner, BeamRelMetadataQuery mq) {
NodeStats inputStat = BeamSqlRelUtils.getNodeStats(this.input, mq);
// Use the planner's row-count (RelSubset-safe) rather than BeamSqlRelUtils.getNodeStats, which

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if BeamSqlrelUtils.getNodeStats should be changed, if we are replacing it with all these trivial inlines. FWIW this comment is actually an OK explanation for the code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

acked. This could be a future improvement

@Abacn
Abacn merged commit 3d5375a into apache:master Oct 22, 2026
110 of 113 checks passed
@Abacn
Abacn deleted the tpcds-py branch October 22, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants