Package com.twilio.kudu.sql.rules
Class RowValueExpressionConverter
java.lang.Object
org.apache.calcite.rex.RexShuttle
com.twilio.kudu.sql.rules.RowValueExpressionConverter
- All Implemented Interfaces:
org.apache.calcite.rex.RexVisitor<org.apache.calcite.rex.RexNode>
public class RowValueExpressionConverter
extends org.apache.calcite.rex.RexShuttle
Used to paginate through rows in the order of the primary key columns by
comparing row expressions with a greater than operator
If the the PK of the table is
(A asc, B asc, C asc) (A, B, C) > ('a1', 'b1', * 'c1')
is transformed
to
(A > 'a1') OR ((A = 'a1') AND (B > 'b1')) OR ((A = 'a1') AND (B = 'b1') AND (C > 'c1'))
If the the PK of the table is
(A asc, B desc, C asc) (A, B, C) > ('a1', 'b1', 'c1')
is transformed
to
(A > 'a1') OR ((A = 'a1') AND (B < 'b1')) OR ((A = 'a1') AND (B = 'b1') AND (C > 'c1'))
This implementation is different from the SQL-92 standard see
https://stackoverflow.com/questions/32981903/sql-syntax-term-for-where-col1-col2-val1-val2/32982077#32982077-
Constructor Summary
ConstructorsConstructorDescriptionRowValueExpressionConverter
(org.apache.calcite.rex.RexBuilder rexBuilder, CalciteKuduTable calciteKuduTable) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.calcite.rex.RexNode
visitCall
(org.apache.calcite.rex.RexCall call) Methods inherited from class org.apache.calcite.rex.RexShuttle
apply, apply, mutate, visitArray, visitCorrelVariable, visitDynamicParam, visitFieldAccess, visitFieldCollations, visitInputRef, visitList, visitLiteral, visitLocalRef, visitOver, visitPatternFieldRef, visitRangeRef, visitSubQuery, visitTableInputRef, visitWindow
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.calcite.rex.RexVisitor
visitEach, visitList, visitList
-
Constructor Details
-
RowValueExpressionConverter
public RowValueExpressionConverter(org.apache.calcite.rex.RexBuilder rexBuilder, CalciteKuduTable calciteKuduTable)
-
-
Method Details
-
visitCall
public org.apache.calcite.rex.RexNode visitCall(org.apache.calcite.rex.RexCall call) - Specified by:
visitCall
in interfaceorg.apache.calcite.rex.RexVisitor<org.apache.calcite.rex.RexNode>
- Overrides:
visitCall
in classorg.apache.calcite.rex.RexShuttle
-