zabetak opened a new pull request, #6117: URL: https://github.com/apache/hive/pull/6117
### What changes were proposed in this pull request? 1. Use `introduceDerivedTable(RelNode)` instead of `introduceDerivedTable(RelNode,RelNode)` to avoid the exception when the (left) input is already modified by the shuttle. 2. Manually link the derived table with the join in `SelfJoinHandler`. 3. Create new join (copy) only if one of the input(s) is modified. ### Why are the changes needed? The problem occurs when we need to introduce a derived table over the left input of the join but the input is already modified (newL) by the shuttle. Looking for the modified input in the join's children fails and raises an exception. Since we know which input needs to be replaced we can avoid the lookup mechanism in `introduceDerivedTable(RelNode, RelNode)` and build directly the new join operator via copy. To avoid unnecessary object creation bubling further up via the HiveRelShuttle mechansim we perform the copy *only* when one of the inputs is modified. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? ``` mvn test -Dtest=TestMiniLlapLocalCliDriver -Dqfile_regex=.*cte.* -Dtest.output.overwrite mvn test -Dtest=TestMiniLlapLocalCliDriver -Dqfile_regex=.*view.* -Dtest.output.overwrite ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
