You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "ankitsultana (via GitHub)" <gi...@apache.org> on 2025/07/10 23:50:50 UTC

[PR] [multistage] Fix Bugs in SetOp Handling and Multi-Column Join [pinot]

ankitsultana opened a new pull request, #16330:
URL: https://github.com/apache/pinot/pull/16330

   Only touches physical optimizer code.
   
   TODO


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] [multistage] Fix Bugs in SetOp Handling and Multi-Column Join [pinot]

Posted by "ankitsultana (via GitHub)" <gi...@apache.org>.
ankitsultana commented on code in PR #16330:
URL: https://github.com/apache/pinot/pull/16330#discussion_r2201498804


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/v2/RelToPRelConverter.java:
##########
@@ -119,8 +122,12 @@ public static PRelNode create(RelNode relNode, Supplier<Integer> nodeIdGenerator
           nodeIdGenerator.get(), null);
     } else if (relNode instanceof Minus) {
       Minus minus = (Minus) relNode;
-      return new PhysicalUnion(minus.getCluster(), minus.getTraitSet(), minus.getHints(), minus.all, inputs,
+      return new PhysicalMinus(minus.getCluster(), minus.getTraitSet(), minus.getHints(), inputs, minus.all,
           nodeIdGenerator.get(), null);
+    } else if (relNode instanceof Intersect) {
+      Intersect intersect = (Intersect) relNode;
+      return new PhysicalIntersect(intersect.getCluster(), intersect.getTraitSet(), intersect.getHints(), inputs,
+          intersect.all, nodeIdGenerator.get(), null);

Review Comment:
   Nope



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] [multistage] Fix Bugs in SetOp Handling and Multi-Column Join [pinot]

Posted by "ankitsultana (via GitHub)" <gi...@apache.org>.
ankitsultana commented on code in PR #16330:
URL: https://github.com/apache/pinot/pull/16330#discussion_r2201505761


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/v2/nodes/PhysicalIntersect.java:
##########
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.query.planner.physical.v2.nodes;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.annotation.Nullable;
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.Intersect;
+import org.apache.calcite.rel.core.SetOp;
+import org.apache.calcite.rel.hint.RelHint;
+import org.apache.pinot.query.planner.physical.v2.PRelNode;
+import org.apache.pinot.query.planner.physical.v2.PinotDataDistribution;
+
+
+public class PhysicalIntersect extends Intersect implements PRelNode {
+  private final int _nodeId;
+  private final List<PRelNode> _pRelInputs;
+  @Nullable
+  private final PinotDataDistribution _pinotDataDistribution;
+
+  public PhysicalIntersect(RelOptCluster cluster, RelTraitSet traits, List<RelHint> hints, List<PRelNode> inputs,
+      boolean all, int nodeId, @Nullable PinotDataDistribution pinotDataDistribution) {
+    super(cluster, traits, hints, inputs.stream().map(PRelNode::unwrap).collect(Collectors.toList()), all);
+    _nodeId = nodeId;
+    _pRelInputs = inputs;
+    _pinotDataDistribution = pinotDataDistribution;
+  }
+
+  @Override
+  public SetOp copy(RelTraitSet traitSet, List<RelNode> inputs, boolean all) {
+    return new PhysicalIntersect(
+        getCluster(), traitSet, getHints(), inputs.stream().map(PRelNode.class::cast).collect(Collectors.toList()),

Review Comment:
   Nope, but our design is such that after RelNode optimization steps, we convert *all* nodes to `PRelNode`, and then only operate with them.
   
   In other words, if a `copy` is called on a `PRelNode`, then it will only be when everything is a PRelNode.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] [multistage] Fix Bugs in SetOp Handling and Multi-Column Join [pinot]

Posted by "itschrispeck (via GitHub)" <gi...@apache.org>.
itschrispeck merged PR #16330:
URL: https://github.com/apache/pinot/pull/16330


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] [multistage] Fix Bugs in SetOp Handling and Multi-Column Join [pinot]

Posted by "shauryachats (via GitHub)" <gi...@apache.org>.
shauryachats commented on code in PR #16330:
URL: https://github.com/apache/pinot/pull/16330#discussion_r2201489003


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/v2/nodes/PhysicalIntersect.java:
##########
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.query.planner.physical.v2.nodes;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.annotation.Nullable;
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.Intersect;
+import org.apache.calcite.rel.core.SetOp;
+import org.apache.calcite.rel.hint.RelHint;
+import org.apache.pinot.query.planner.physical.v2.PRelNode;
+import org.apache.pinot.query.planner.physical.v2.PinotDataDistribution;
+
+
+public class PhysicalIntersect extends Intersect implements PRelNode {
+  private final int _nodeId;
+  private final List<PRelNode> _pRelInputs;
+  @Nullable
+  private final PinotDataDistribution _pinotDataDistribution;
+
+  public PhysicalIntersect(RelOptCluster cluster, RelTraitSet traits, List<RelHint> hints, List<PRelNode> inputs,
+      boolean all, int nodeId, @Nullable PinotDataDistribution pinotDataDistribution) {
+    super(cluster, traits, hints, inputs.stream().map(PRelNode::unwrap).collect(Collectors.toList()), all);
+    _nodeId = nodeId;
+    _pRelInputs = inputs;
+    _pinotDataDistribution = pinotDataDistribution;
+  }
+
+  @Override
+  public SetOp copy(RelTraitSet traitSet, List<RelNode> inputs, boolean all) {
+    return new PhysicalIntersect(
+        getCluster(), traitSet, getHints(), inputs.stream().map(PRelNode.class::cast).collect(Collectors.toList()),

Review Comment:
   Are all `RelNode` castable to `PRelNode`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] [multistage] Fix Bugs in SetOp Handling and Multi-Column Join [pinot]

Posted by "shauryachats (via GitHub)" <gi...@apache.org>.
shauryachats commented on code in PR #16330:
URL: https://github.com/apache/pinot/pull/16330#discussion_r2201492257


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/v2/RelToPRelConverter.java:
##########
@@ -119,8 +122,12 @@ public static PRelNode create(RelNode relNode, Supplier<Integer> nodeIdGenerator
           nodeIdGenerator.get(), null);
     } else if (relNode instanceof Minus) {
       Minus minus = (Minus) relNode;
-      return new PhysicalUnion(minus.getCluster(), minus.getTraitSet(), minus.getHints(), minus.all, inputs,
+      return new PhysicalMinus(minus.getCluster(), minus.getTraitSet(), minus.getHints(), inputs, minus.all,
           nodeIdGenerator.get(), null);
+    } else if (relNode instanceof Intersect) {
+      Intersect intersect = (Intersect) relNode;
+      return new PhysicalIntersect(intersect.getCluster(), intersect.getTraitSet(), intersect.getHints(), inputs,
+          intersect.all, nodeIdGenerator.get(), null);

Review Comment:
   nit: does `getAll()` not exist?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] [multistage] Fix Bugs in SetOp Handling and Multi-Column Join [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #16330:
URL: https://github.com/apache/pinot/pull/16330#issuecomment-3060569866

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/16330?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `93.75000%` with `3 lines` in your changes missing coverage. Please review.
   > Project coverage is 56.35%. Comparing base [(`1a476de`)](https://app.codecov.io/gh/apache/pinot/commit/1a476dea72ebf1c15e14ded28ae60c385f71b2c3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`6fe7df4`)](https://app.codecov.io/gh/apache/pinot/commit/6fe7df475f33adfe86a68bacbba7699458814c7f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 437 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/pinot/pull/16330?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...cal/v2/opt/rules/WorkerExchangeAssignmentRule.java](https://app.codecov.io/gh/apache/pinot/pull/16330?src=pr&el=tree&filepath=pinot-query-planner%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fquery%2Fplanner%2Fphysical%2Fv2%2Fopt%2Frules%2FWorkerExchangeAssignmentRule.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcGxhbm5lci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcXVlcnkvcGxhbm5lci9waHlzaWNhbC92Mi9vcHQvcnVsZXMvV29ya2VyRXhjaGFuZ2VBc3NpZ25tZW50UnVsZS5qYXZh) | 85.71% | [0 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/pinot/pull/16330?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...ache/pinot/calcite/rel/traits/TraitAssignment.java](https://app.codecov.io/gh/apache/pinot/pull/16330?src=pr&el=tree&filepath=pinot-query-planner%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fcalcite%2Frel%2Ftraits%2FTraitAssignment.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcGxhbm5lci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2FsY2l0ZS9yZWwvdHJhaXRzL1RyYWl0QXNzaWdubWVudC5qYXZh) | 93.33% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/pinot/pull/16330?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   > :exclamation:  There is a different number of reports uploaded between BASE (1a476de) and HEAD (6fe7df4). Click for more details.
   > 
   > <details><summary>HEAD has 68 uploads less than BASE</summary>
   >
   >| Flag | BASE (1a476de) | HEAD (6fe7df4) |
   >|------|------|------|
   >|java-21|10|1|
   >|unittests|6|1|
   >|unittests1|3|1|
   >|skip-bytebuffers-true|4|0|
   >|temurin|15|1|
   >|unittests2|3|0|
   >|skip-bytebuffers-false|8|0|
   >|java-11|5|0|
   >|integration|9|0|
   >|integration2|3|0|
   >|integration1|3|0|
   >|custom-integration1|3|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #16330      +/-   ##
   ============================================
   - Coverage     62.90%   56.35%   -6.56%     
   + Complexity     1386      699     -687     
   ============================================
     Files          2867     2319     -548     
     Lines        163354   128159   -35195     
     Branches      24952    20409    -4543     
   ============================================
   - Hits         102755    72219   -30536     
   + Misses        52847    49969    -2878     
   + Partials       7752     5971    -1781     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-11](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-21](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.35% <93.75%> (-6.48%)` | :arrow_down: |
   | [skip-bytebuffers-false](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [skip-bytebuffers-true](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.35% <93.75%> (-6.56%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.35% <93.75%> (-6.55%)` | :arrow_down: |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.35% <93.75%> (+0.53%)` | :arrow_up: |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/16330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/16330?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org