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 not valid when the ValuesNode contains a non-deterministic expression. According to the semantics of the original plan, such expression should be evaluated once, and the value should be appended to each row of the other join source. Inlining the expression would result in evaluating it for each row to a potentially different value.
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 invalid input: '<'- expr1
c invalid input: '<'- expr2
into:
- project (a invalid input: '<'- a, b invalid input: '<'- expr1, c invalid input: '<'- 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.