Skip to content

Conversation

@Jackie-Jiang
Copy link
Contributor

Creates a new Context for each PlanFragmenter to avoid the convoluted logic.

@Jackie-Jiang Jackie-Jiang added refactor multi-stage Related to the multi-stage query engine labels Oct 31, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2023

Codecov Report

Merging #11912 (32c200d) into master (abad6c8) will decrease coverage by 0.06%.
Report is 4 commits behind head on master.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master   #11912      +/-   ##
============================================
- Coverage     61.50%   61.45%   -0.06%     
  Complexity     1147     1147              
============================================
  Files          2378     2378              
  Lines        128844   128845       +1     
  Branches      19925    19924       -1     
============================================
- Hits          79242    79178      -64     
- Misses        43858    43945      +87     
+ Partials       5744     5722      -22     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (ø)
integration <0.01% <0.00%> (ø)
integration1 <0.01% <0.00%> (ø)
integration2 0.00% <0.00%> (ø)
java-11 61.38% <100.00%> (-0.07%) ⬇️
java-21 61.32% <100.00%> (+<0.01%) ⬆️
skip-bytebuffers-false 61.42% <100.00%> (-0.07%) ⬇️
skip-bytebuffers-true 61.28% <100.00%> (+0.01%) ⬆️
temurin 61.45% <100.00%> (-0.06%) ⬇️
unittests 61.44% <100.00%> (-0.06%) ⬇️
unittests1 46.63% <100.00%> (+0.01%) ⬆️
unittests2 27.67% <0.00%> (-0.07%) ⬇️

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

Files Coverage Δ
...uery/planner/logical/PinotLogicalQueryPlanner.java 87.50% <100.00%> (-0.44%) ⬇️
...he/pinot/query/planner/logical/PlanFragmenter.java 88.37% <100.00%> (-0.99%) ⬇️

... and 26 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

// Split the ExchangeNode to a MailboxReceiveNode and a MailboxSendNode, where MailboxReceiveNode is the leave node
// of the current PlanFragment, and MailboxSendNode is the root node of the next PlanFragment.
int receiverPlanFragmentId = context._currentPlanFragmentId;
int senderPlanFragmentId = context._nextPlanFragmentId.getAndIncrement();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: visitor pattern is single threaded so i dont think we need to have atomic integer here.

this "getAndIncrement" is still confusing --> if we are handling one context per visit upon hitting an exchange then this is the only variable that's cross all fragments: IIUC, the only reason this works is b/c the nextPlanFragmentId is passed by reference so it is not really contain within the context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified to MutableInt to avoid confusion.
IMO this is the correct way to handle this recursion. Basically we share _nextPlanFragmentId across all PlanFragments to ensure uniqueness of PlanFragment ID. Added a comment to explain this

Copy link
Contributor

Choose a reason for hiding this comment

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

yes i think that's correct. i was wondering if we can make it even more straightforward.

  • IMO the "context" is pre-fragment
  • but the global next ID is per planFragmenter --> we can create a global next ID tracker inside the planFragmenter instead (ditch the static INSTANCE approach)

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, refactored again

final Map<Integer, PlanFragment> _planFragmentIdToRootNodeMap;
final Map<Integer, List<Integer>> _planFragmentIdToChildrenMap;

public Context() {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need this public constructor? no one is using it right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is used in PinotLogicalQueryPlanner to create the initial Context

@Jackie-Jiang Jackie-Jiang merged commit 03a9ec7 into apache:master Nov 1, 2023
@Jackie-Jiang Jackie-Jiang deleted the simplify_plan_fragmenter branch November 1, 2023 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multi-stage Related to the multi-stage query engine refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants