vvysotskyi commented on a change in pull request #1426: DRILL-6671: Multi level
lateral unnest join is throwing an exception …
URL: https://github.com/apache/drill/pull/1426#discussion_r208520804
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/LateralUnnestRowIDVisitor.java
##########
@@ -64,7 +66,14 @@ public Prel visitLateral(LateralJoinPrel prel, Boolean
value) throws RuntimeExce
children.add(((Prel)prel.getInput(0)).accept(this, value));
children.add(((Prel) prel.getInput(1)).accept(this, true));
- return (Prel) prel.copy(prel.getTraitSet(), children);
+ if (!value) {
+ return (Prel) prel.copy(prel.getTraitSet(), children);
+ } else {
+ CorrelationId corrId = new CorrelationId(prel.getCorrelationId().getId()
+ 1);
Review comment:
Passing increased `id` to `CorrelationId` may cause problems since inputs of
`LateralJoinPrel` also may contain both `CorrelationId`s with old and new `id`s
and it may cause problems for some queries. I would recommend receiving
`CorrelationId` by calling `prel.getCluster().createCorrel()`, since it
guarantees that the index will be unique.
Also, just creating and passing a new `CorrelationId` instance to the
`LateralJoinPrel` is not enough, because as I mentioned above, inputs refer to
it, so all these references should be replaced. As an example of this approach,
you may use code from
[ProjectCorrelateTransposeRule](https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/ProjectCorrelateTransposeRule.java#L124).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services