Skip to content

Conversation

@yashmayya
Copy link
Contributor

@yashmayya yashmayya commented May 16, 2024

LogicalMinus(all=[true])
  PinotLogicalExchange(distribution=[hash[0]])
    LogicalProject(a=[$3])
      LogicalTableScan(table=[[default, A]])
  PinotLogicalExchange(distribution=[hash[0]])
    LogicalProject(b=[$3])
      LogicalTableScan(table=[[default, B]])
  • The physical plan for queries, however, currently doesn't include whether or not the ALL modifier was used. So the output for both EXPLAIN IMPLEMENTATION PLAN FOR SELECT * FROM (SELECT a FROM A) EXCEPT ALL (SELECT b FROM B); and EXPLAIN IMPLEMENTATION PLAN FOR SELECT * FROM (SELECT a FROM A) EXCEPT (SELECT b FROM B); would look the same:
[0]@192.168.29.25:64480|[0] MAIL_RECEIVE(BROADCAST_DISTRIBUTED)
└── [1]@192.168.29.25:64487|[0] MAIL_SEND(BROADCAST_DISTRIBUTED)->{[0]@192.168.29.25:64480|[0]}
    └── [1]@192.168.29.25:64487|[0] MINUS
        └── [1]@192.168.29.25:64487|[0] MAIL_RECEIVE(HASH_DISTRIBUTED)
        └── [1]@192.168.29.25:64487|[0] MAIL_RECEIVE(HASH_DISTRIBUTED)
  • This PR fixes the issue by updating SetOpNode::explain which is called in the PhysicalExplainPlanVisitor here. The output for EXPLAIN IMPLEMENTATION PLAN FOR SELECT * FROM (SELECT a FROM A) EXCEPT ALL (SELECT b FROM B); now looks like:
[0]@192.168.29.25:64480|[0] MAIL_RECEIVE(BROADCAST_DISTRIBUTED)
└── [1]@192.168.29.25:64487|[0] MAIL_SEND(BROADCAST_DISTRIBUTED)->{[0]@192.168.29.25:64480|[0]}
    └── [1]@192.168.29.25:64487|[0] MINUS_ALL
        └── [1]@192.168.29.25:64487|[0] MAIL_RECEIVE(HASH_DISTRIBUTED)
        └── [1]@192.168.29.25:64487|[0] MAIL_RECEIVE(HASH_DISTRIBUTED)

@yashmayya yashmayya force-pushed the set-op-all-physical-plan branch from 0e104a6 to dd67957 Compare May 16, 2024 07:31
@yashmayya yashmayya changed the title Add all modifier for set operators in multi-stage query engine physical explain plan Include ALL modifier for set operators in multi-stage query engine physical explain plan May 16, 2024
@Override
public String explain() {
return _setOpType.toString();
return _all ? _setOpType.toString() + "_ALL" : _setOpType.toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it works in Union? AFAIR union always behaves as all = true. Is this attribute always true in union?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it does look like this attribute is always true for the union set operation (i.e., regardless of whether we use UNION or UNION ALL). I guess that isn't inaccurate though since the actual semantics being implemented are indeed the UNION ALL semantics and the logical plan also contains LogicalUnion(all=[true]) for both UNION and UNION ALL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I just noticed that the query plan for UNION contains an aggregation on top to only get unique values from the result of the UNION ALL, interesting.

@codecov-commenter
Copy link

codecov-commenter commented May 16, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 62.15%. Comparing base (59551e4) to head (dd67957).
Report is 451 commits behind head on master.

Files Patch % Lines
...apache/pinot/query/planner/plannode/SetOpNode.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #13166      +/-   ##
============================================
+ Coverage     61.75%   62.15%   +0.40%     
+ Complexity      207      198       -9     
============================================
  Files          2436     2517      +81     
  Lines        133233   137895    +4662     
  Branches      20636    21340     +704     
============================================
+ Hits          82274    85713    +3439     
- Misses        44911    45798     +887     
- Partials       6048     6384     +336     
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 62.12% <0.00%> (+0.41%) ⬆️
java-21 62.04% <0.00%> (+0.41%) ⬆️
skip-bytebuffers-false 62.14% <0.00%> (+0.39%) ⬆️
skip-bytebuffers-true 62.01% <0.00%> (+34.28%) ⬆️
temurin 62.15% <0.00%> (+0.40%) ⬆️
unittests 62.15% <0.00%> (+0.40%) ⬆️
unittests1 46.74% <0.00%> (-0.15%) ⬇️
unittests2 27.77% <0.00%> (+0.04%) ⬆️

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.

@gortiz gortiz merged commit 41dae72 into apache:master May 16, 2024
gortiz pushed a commit to gortiz/pinot that referenced this pull request Jun 14, 2024
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.

3 participants