zabetak commented on code in PR #5249:
URL: https://github.com/apache/hive/pull/5249#discussion_r1685454423
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java:
##########
@@ -1737,6 +1747,14 @@ public RelNode apply(RelOptCluster cluster, RelOptSchema
relOptSchema, SchemaPlu
perfLogger.perfLogBegin(this.getClass().getName(),
PerfLogger.POSTJOIN_ORDERING);
calcitePlan = applyPostJoinOrderingTransform(calcitePlan,
mdProvider.getMetadataProvider(), executorProvider);
perfLogger.perfLogEnd(this.getClass().getName(),
PerfLogger.POSTJOIN_ORDERING);
+ // Perform the CTE rewriting near the end of CBO transformations to
avoid interference of the new HiveTableSpool
+ // operator with other rules (especially those related to constant
folding and branch pruning).
Review Comment:
In fact it is more problematic when on side of the union is pruned and the
other remains. The actual risk is to have one branch with a CTE scan with no
corresponding spool. I added corresponding tests in
https://github.com/apache/hive/pull/5249/commits/c62adf3fe26035a3f2d8857292de595d861be927
--
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]