Skip to content

[multistage] Lite Mode with Scatter Gather Execution#16000

Merged
ankitsultana merged 5 commits intoapache:masterfrom
ankitsultana:mse-lite-p3
Jun 7, 2025
Merged

[multistage] Lite Mode with Scatter Gather Execution#16000
ankitsultana merged 5 commits intoapache:masterfrom
ankitsultana:mse-lite-p3

Conversation

@ankitsultana
Copy link
Contributor

@ankitsultana ankitsultana commented Jun 4, 2025

Summary

Adds the ability in Lite Mode to run all of the non-leaf stages in the broker directly, similar to the the scatter gather design of the V1 engine.

I am also fixing a bug in the Lite Mode where I wasn't honoring the collation traits.

Test Plan

Both of these features are covered by unit-tests. I have done some manual tests with a Quickstart.

E2E tests which also run queries will be added as part of #15958.

@ankitsultana ankitsultana added multi-stage Related to the multi-stage query engine mse-physical-optimizer mse-lite-mode labels Jun 4, 2025
@ankitsultana ankitsultana changed the title [multistage] Lite Mode with Scatter Gather Execution + Sort Bug Fix [multistage] Lite Mode with Scatter Gather Execution Jun 5, 2025
"sql": "SET usePhysicalOptimizer=true; SET useLiteMode=true; SET runInBroker=true; EXPLAIN PLAN FOR WITH tmp AS (SELECT col1, col2, col3, COUNT(*) FROM a WHERE col1 = 'foo' GROUP BY col1, col2, col3 ORDER BY col2) SELECT * FROM tmp LIMIT 100,400",
"output": [
"Execution Plan",
"\nPhysicalSort(offset=[100], fetch=[400])",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that unlike other plans, the top-most plan node here is not an exchange. Reason is that the exchange in the sub-tree sends data to the broker directly, and there's no exchange required after that.

If there's a collation trait to be met, that'll be met by adding a sort.

@ankitsultana ankitsultana marked this pull request as ready for review June 5, 2025 03:35
@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.

Project coverage is 63.37%. Comparing base (1a476de) to head (473e50f).
Report is 213 commits behind head on master.

Files with missing lines Patch % Lines
...cal/v2/opt/rules/LiteModeWorkerAssignmentRule.java 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #16000      +/-   ##
============================================
+ Coverage     62.90%   63.37%   +0.47%     
+ Complexity     1386     1357      -29     
============================================
  Files          2867     2913      +46     
  Lines        163354   167061    +3707     
  Branches      24952    25555     +603     
============================================
+ Hits         102755   105877    +3122     
- Misses        52847    53168     +321     
- Partials       7752     8016     +264     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 63.34% <96.55%> (+0.47%) ⬆️
java-21 63.35% <96.55%> (+0.52%) ⬆️
skip-bytebuffers-false ?
skip-bytebuffers-true ?
temurin 63.37% <96.55%> (+0.47%) ⬆️
unittests 63.37% <96.55%> (+0.47%) ⬆️
unittests1 56.47% <96.55%> (+0.65%) ⬆️
unittests2 33.42% <6.89%> (-0.15%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


public LiteModeWorkerAssignmentRule(PhysicalPlannerContext context) {
_context = context;
_runInBroker = Boolean.parseBoolean(context.getQueryOptions().getOrDefault(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to move this to QueryOptionUtils. Will update

Copy link
Contributor

@wirybeaver wirybeaver left a comment

Choose a reason for hiding this comment

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

LGTM

@ankitsultana ankitsultana merged commit fe7086b into apache:master Jun 7, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mse-lite-mode mse-physical-optimizer multi-stage Related to the multi-stage query engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants