Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix incline CTE
  • Loading branch information
cloud-fan committed Oct 7, 2022
commit 041ddd00a59c90a896b7e68ef03fecc74c0c8079
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ case class InlineCTE(alwaysInline: Boolean = false) extends Rule[LogicalPlan] {
val ctePlan = DeduplicateRelations(
Join(cteDef.child, cteDef.child, Inner, None, JoinHint(None, None))).children(1)
val projectList = ref.output.zip(ctePlan.output).map { case (tgtAttr, srcAttr) =>
Alias(srcAttr, tgtAttr.name)(exprId = tgtAttr.exprId)
if (srcAttr.semanticEquals(tgtAttr)) {
tgtAttr
} else {
Alias(srcAttr, tgtAttr.name)(exprId = tgtAttr.exprId)
}
}
Project(projectList, ctePlan)
}
Expand Down