public class SqlCaseWithValueOperatorRewriter extends java.lang.Object implements SqlOperatorRewriter
Turns:
CASE x
WHEN w1 THEN t1
WHEN w2 THEN t2
ELSE e
END
into:
CASE
WHEN x == w1 THEN t1
WHEN x == w2 THEN t2
ELSE expr
END
Note that the ELSE statement is actually optional, but we don't need to worry about that here because the ZetaSQL analyzer populates the ELSE argument as a NULL literal if it's not specified.
Constructor and Description |
---|
SqlCaseWithValueOperatorRewriter() |
Modifier and Type | Method and Description |
---|---|
org.apache.calcite.rex.RexNode |
apply(org.apache.calcite.rex.RexBuilder rexBuilder,
java.util.List<org.apache.calcite.rex.RexNode> operands)
Create and return a new
RexNode that represents a call to this operator with the
specified operands. |
public org.apache.calcite.rex.RexNode apply(org.apache.calcite.rex.RexBuilder rexBuilder, java.util.List<org.apache.calcite.rex.RexNode> operands)
SqlOperatorRewriter
RexNode
that represents a call to this operator with the
specified operands.apply
in interface SqlOperatorRewriter
rexBuilder
- A RexBuilder
instance to use for creating new RexNode
soperands
- The original list of RexNode
operands passed to this operator call