Skip to content

Conversation

@walterddr
Copy link
Contributor

@walterddr walterddr commented Oct 20, 2023

currently pinotQuery only supports limited amount of PlanNodes
this means an Exchange must be inserted in order to ensure the leaf stage can be converted into a PinotQuery. However this is a misuse of Exchange

This PR plans to split the ServerRequest planning into 2 stages

  1. first plan as much as possible into PinotQuery
  2. for any remainder nodes that cannot be planned into PinotQuery, will be run together with the LeafStageTransferrableBlockOperator as the input locally.

This PR also follows up with the refactoring from #11439.

  • removed server plan request context entirely and replace it with fields used by server side.
  • extends OpChainExecutionContext with additional info from ServerOpChainExecutionContext
  • break down steps from ServerPlanRequestUtils.build method into 3 parts -->
    1. compile pinot query
    2. convert pinot query into instance requests (based on physical segments)
    3. construct an OpChain that sits on top

Follow up

It is not easy to test the server physical plan gen, so this PR only utilize existing test cases, and more comprehensive tests are done in #11831

@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2023

Codecov Report

Merging #11843 (9feecdb) into master (8d49b11) will increase coverage by 0.04%.
The diff coverage is 79.45%.

@@             Coverage Diff              @@
##             master   #11843      +/-   ##
============================================
+ Coverage     61.40%   61.45%   +0.04%     
+ Complexity     1145      207     -938     
============================================
  Files          2378     2380       +2     
  Lines        128851   128926      +75     
  Branches      19926    19942      +16     
============================================
+ Hits          79127    79232     +105     
+ Misses        44002    43949      -53     
- Partials       5722     5745      +23     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 61.38% <79.45%> (+26.64%) ⬆️
java-21 61.33% <79.45%> (+0.04%) ⬆️
skip-bytebuffers-false 61.41% <79.45%> (+0.01%) ⬆️
skip-bytebuffers-true 61.31% <79.45%> (+0.05%) ⬆️
temurin 61.45% <79.45%> (+0.04%) ⬆️
unittests 61.45% <79.45%> (+0.04%) ⬆️
unittests1 46.64% <79.45%> (+0.02%) ⬆️
unittests2 27.66% <0.00%> (+0.01%) ⬆️

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

Files Coverage Δ
...ot/common/request/context/RequestContextUtils.java 68.00% <100.00%> (+0.36%) ⬆️
...n/request/context/predicate/ConstantPredicate.java 100.00% <100.00%> (ø)
...ot/common/request/context/predicate/Predicate.java 100.00% <100.00%> (ø)
...src/main/java/org/apache/pinot/sql/FilterKind.java 100.00% <100.00%> (ø)
...ery/optimizer/filter/NumericalFilterOptimizer.java 81.95% <ø> (ø)
...va/org/apache/pinot/query/runtime/QueryRunner.java 77.31% <100.00%> (-3.39%) ⬇️
...ot/query/runtime/plan/OpChainExecutionContext.java 97.43% <100.00%> (+1.28%) ⬆️
...ime/plan/server/ServerOpChainExecutionContext.java 100.00% <100.00%> (ø)
...ry/runtime/plan/server/ServerPlanRequestUtils.java 82.28% <100.00%> (+3.33%) ⬆️
...ava/org/apache/pinot/core/plan/FilterPlanNode.java 81.29% <50.00%> (-0.93%) ⬇️
... and 2 more

... and 12 files with indirect coverage changes

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

@walterddr walterddr changed the title [draft][multistage]Ability to run PhysicalPlanVisitor on leaf for residual nodes [draft][multistage] run PhysicalPlanVisitor on leaf for residual nodes Oct 24, 2023
@Jackie-Jiang Jackie-Jiang added enhancement multi-stage Related to the multi-stage query engine labels Oct 25, 2023
@walterddr walterddr force-pushed the poc_rel_distribution_leaf_planning branch 2 times, most recently from 79a7a69 to 36546bb Compare October 30, 2023 17:01
connected with QueryRunner

refactor and simplify leaf stage compilation

fix linter and further refactoring

simplified visitor and context class, add javadoc

fix server plan request gen issues
@walterddr walterddr force-pushed the poc_rel_distribution_leaf_planning branch from 36546bb to ca4380b Compare October 31, 2023 22:42
@walterddr walterddr force-pushed the poc_rel_distribution_leaf_planning branch from 5ccf4e2 to c7003bb Compare November 1, 2023 00:17
Comment on lines +265 to +269
// put a constant false expression
Expression constantFalseExpr = RequestUtils.getFunctionExpression(FilterKind.CONSTANT.name());
constantFalseExpr.getFunctionCall().setOperands(Arrays.asList(leftExpr,
RequestUtils.getLiteralExpression(false)));
expressions.add(constantFalseExpr);
Copy link
Contributor Author

@walterddr walterddr Nov 1, 2023

Choose a reason for hiding this comment

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

this is not actually the right way to go b/c this basically requires the query to be written in the format of

SELECT ... WHERE CONSTANT(someCol, false)

instead of the right way:

SELECT ... WHERE CONSTANT(false)

or

SELECT ... WHERE false

however, it will be a bit more complex to make a constant supported Predicate b/c it assumes the LHS to be an identifier in most of the pinot-server code.

@walterddr walterddr marked this pull request as ready for review November 1, 2023 01:33
@walterddr walterddr changed the title [draft][multistage] run PhysicalPlanVisitor on leaf for residual nodes [multistage] run PhysicalPlanVisitor on leaf for residual nodes Nov 1, 2023
@walterddr
Copy link
Contributor Author

closing in favor of #11937

@walterddr walterddr closed this Nov 2, 2023
walterddr added a commit that referenced this pull request Nov 13, 2023
)

currently pinotQuery only supports limited amount of PlanNodes
this means an Exchange must be inserted in order to ensure the leaf stage can be converted into a PinotQuery. However this is a misuse of Exchange

This PR plans to split the ServerRequest planning into 2 stages
- first plan as much as possible into PinotQuery
- for any remainder nodes that cannot be planned into PinotQuery, will be run together with the LeafStageTransferrableBlockOperator as the input locally.

This PR also follows up with the refactoring from #11439.
- removed server plan request context entirely and replace it with fields used by server side.
- extends OpChainExecutionContext with additional info from ServerOpChainExecutionContext
- break down steps from ServerPlanRequestUtils.build method into 3 parts -->
    - compile pinot query
    - convert pinot query into instance requests (based on physical segments)
    - construct an OpChain that sits on top

Context: alternative PR to #11843

---------

Co-authored-by: Rong Rong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement feature multi-stage Related to the multi-stage query engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants