Class CassandraFilter.Translator
- java.lang.Object
-
- org.apache.calcite.adapter.cassandra.CassandraFilter.Translator
-
- Enclosing class:
- CassandraFilter
static class CassandraFilter.Translator extends java.lang.Object
TranslatesRexNode
expressions into Cassandra expression strings.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>
clusteringKeys
private java.util.List<java.lang.String>
fieldNames
private java.util.List<RelFieldCollation>
implicitFieldCollations
private java.util.Set<java.lang.String>
partitionKeys
private int
restrictedClusteringKeys
private RelDataType
rowType
-
Constructor Summary
Constructors Constructor Description Translator(RelDataType rowType, java.util.List<java.lang.String> partitionKeys, java.util.List<java.lang.String> clusteringKeys, java.util.List<RelFieldCollation> implicitFieldCollations)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RelCollation
getImplicitCollation()
Infer the implicit correlation from the unrestricted clustering keys.boolean
isSinglePartition()
Check if the query spans only one partition.private static java.lang.String
literalValue(RexLiteral literal)
Convert the value of a literal to a string.private java.lang.String
translateAnd(RexNode condition)
Translate a conjunctive predicate to a CQL string.private java.lang.String
translateBinary(java.lang.String op, java.lang.String rop, RexCall call)
Translates a call to a binary operator, reversing arguments if necessary.private java.lang.String
translateBinary2(java.lang.String op, RexNode left, RexNode right)
Translates a call to a binary operator.private java.lang.String
translateMatch(RexNode condition)
Produce the CQL predicate string for the given condition.private java.lang.String
translateMatch2(RexNode node)
Translate a binary relation.private java.lang.String
translateOp2(java.lang.String op, java.lang.String name, RexLiteral right)
Combines a field name, operator, and literal to produce a predicate string.
-
-
-
Field Detail
-
rowType
private final RelDataType rowType
-
fieldNames
private final java.util.List<java.lang.String> fieldNames
-
partitionKeys
private final java.util.Set<java.lang.String> partitionKeys
-
clusteringKeys
private final java.util.List<java.lang.String> clusteringKeys
-
restrictedClusteringKeys
private int restrictedClusteringKeys
-
implicitFieldCollations
private final java.util.List<RelFieldCollation> implicitFieldCollations
-
-
Constructor Detail
-
Translator
Translator(RelDataType rowType, java.util.List<java.lang.String> partitionKeys, java.util.List<java.lang.String> clusteringKeys, java.util.List<RelFieldCollation> implicitFieldCollations)
-
-
Method Detail
-
isSinglePartition
public boolean isSinglePartition()
Check if the query spans only one partition.- Returns:
- True if the matches translated so far have resulted in a single partition
-
getImplicitCollation
public RelCollation getImplicitCollation()
Infer the implicit correlation from the unrestricted clustering keys.- Returns:
- The collation of the filtered results
-
translateMatch
private java.lang.String translateMatch(RexNode condition)
Produce the CQL predicate string for the given condition.- Parameters:
condition
- Condition to translate- Returns:
- CQL predicate string
-
literalValue
private static java.lang.String literalValue(RexLiteral literal)
Convert the value of a literal to a string.- Parameters:
literal
- Literal to translate- Returns:
- String representation of the literal
-
translateAnd
private java.lang.String translateAnd(RexNode condition)
Translate a conjunctive predicate to a CQL string.- Parameters:
condition
- A conjunctive predicate- Returns:
- CQL string for the predicate
-
translateMatch2
private java.lang.String translateMatch2(RexNode node)
Translate a binary relation.
-
translateBinary
private java.lang.String translateBinary(java.lang.String op, java.lang.String rop, RexCall call)
Translates a call to a binary operator, reversing arguments if necessary.
-
translateBinary2
private java.lang.String translateBinary2(java.lang.String op, RexNode left, RexNode right)
Translates a call to a binary operator. Returns null on failure.
-
translateOp2
private java.lang.String translateOp2(java.lang.String op, java.lang.String name, RexLiteral right)
Combines a field name, operator, and literal to produce a predicate string.
-
-