Class ReplaceJoinOverConstantWithProject
Note 1: When transforming an outer join (LEFT, RIGHT or FULL), and an outer source is a single row ValuesNode, it is checked that the other source is not empty. If it is possibly empty, the transformation cannot be done, because the result of the transformation would be possibly empty, while the single constant row should be preserved on output.
Note 2: The transformation is valid when the ValuesNode contains non-deterministic expressions. This is because any expression from the ValuesNode can only be used once. Assignments.Builder deduplicates them in case when the JoinNode produces any of the input symbols more than once.
Note 3: The transformation is valid when the ValuesNode contains expressions using correlation symbols. They are constant from the perspective of the transformed plan.
Transforms:
- join (on true), layout: (a, b, c)
- source (a)
- values
b <- expr1
c <- expr2
into:
- project (a <- a, b <- expr1, c <- expr2)
- source (a)
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.trino.sql.planner.iterative.Rule
Rule.Context, Rule.Result -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(JoinNode node, Captures captures, Rule.Context context) Returns a pattern to which plan nodes this rule applies.
-
Constructor Details
-
ReplaceJoinOverConstantWithProject
public ReplaceJoinOverConstantWithProject()
-
-
Method Details