Skip to content

Commit

Permalink
rebase code
Browse files Browse the repository at this point in the history
  • Loading branch information
starocean999 committed Jul 6, 2023
1 parent 6543d09 commit 4f5fc89
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ private LogicalPlan rewrite(LogicalPlan p, CascadesContext cascadesContext) {
}
LogicalCTE logicalCTE = (LogicalCTE) p;
LogicalPlan child = (LogicalPlan) logicalCTE.child();
for (int i = logicalCTE.getAliasQueries().size() - 1; i >= 0; i--) {
LogicalSubQueryAlias s = (LogicalSubQueryAlias) logicalCTE.getAliasQueries().get(i);
CTEId id = logicalCTE.findCTEId(s.getAlias());
if (cascadesContext.cteReferencedCount(id)
<= ConnectContext.get().getSessionVariable().inlineCTEReferencedThreshold
|| !ConnectContext.get().getSessionVariable().getEnablePipelineEngine()) {
continue;
if (!(child instanceof LogicalEmptyRelation)) {
for (int i = logicalCTE.getAliasQueries().size() - 1; i >= 0; i--) {
LogicalSubQueryAlias s = (LogicalSubQueryAlias) logicalCTE.getAliasQueries().get(i);
CTEId id = logicalCTE.findCTEId(s.getAlias());
if (cascadesContext.cteReferencedCount(id)
<= ConnectContext.get().getSessionVariable().inlineCTEReferencedThreshold
|| !ConnectContext.get().getSessionVariable().getEnablePipelineEngine()) {
continue;
}
LogicalCTEProducer logicalCTEProducer = new LogicalCTEProducer(
rewrite((LogicalPlan) s.child(), cascadesContext), id);
child = new LogicalCTEAnchor(logicalCTEProducer, child, id);
}
}
return child;
Expand Down

0 comments on commit 4f5fc89

Please sign in to comment.