Class CassandraTable
- java.lang.Object
-
- org.apache.calcite.schema.impl.AbstractTable
-
- org.apache.calcite.adapter.java.AbstractQueryableTable
-
- org.apache.calcite.adapter.cassandra.CassandraTable
-
- All Implemented Interfaces:
QueryableTable
,Table
,TranslatableTable
,Wrapper
public class CassandraTable extends AbstractQueryableTable implements TranslatableTable
Table based on a Cassandra column family
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CassandraTable.CassandraQueryable<T>
Implementation ofQueryable
based on aCassandraTable
.
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<RelFieldCollation>
clusteringOrder
private java.lang.String
columnFamily
(package private) Pair<java.util.List<java.lang.String>,java.util.List<java.lang.String>>
keyFields
(package private) RelProtoDataType
protoRowType
private CassandraSchema
schema
private boolean
view
-
Fields inherited from class org.apache.calcite.adapter.java.AbstractQueryableTable
elementType
-
-
Constructor Summary
Constructors Constructor Description CassandraTable(CassandraSchema schema, java.lang.String columnFamily)
CassandraTable(CassandraSchema schema, java.lang.String columnFamily, boolean view)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Queryable<T>
asQueryable(QueryProvider queryProvider, SchemaPlus schema, java.lang.String tableName)
Converts this table into aQueryable
.java.util.List<RelFieldCollation>
getClusteringOrder()
Pair<java.util.List<java.lang.String>,java.util.List<java.lang.String>>
getKeyFields()
RelDataType
getRowType(RelDataTypeFactory typeFactory)
Returns this table's row type.Enumerable<java.lang.Object>
query(com.datastax.driver.core.Session session)
Enumerable<java.lang.Object>
query(com.datastax.driver.core.Session session, java.util.List<java.util.Map.Entry<java.lang.String,java.lang.Class>> fields, java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> selectFields, java.util.List<java.lang.String> predicates, java.util.List<java.lang.String> order, java.lang.Integer offset, java.lang.Integer fetch)
Executes a CQL query on the underlying table.RelNode
toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable)
Converts this table into arelational expression
.java.lang.String
toString()
-
Methods inherited from class org.apache.calcite.adapter.java.AbstractQueryableTable
getElementType, getExpression
-
Methods inherited from class org.apache.calcite.schema.impl.AbstractTable
getJdbcTableType, getStatistic, isRolledUp, rolledUpColumnValidInsideAgg, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.schema.Table
getJdbcTableType, getStatistic, isRolledUp, rolledUpColumnValidInsideAgg
-
-
-
-
Field Detail
-
protoRowType
RelProtoDataType protoRowType
-
keyFields
Pair<java.util.List<java.lang.String>,java.util.List<java.lang.String>> keyFields
-
clusteringOrder
java.util.List<RelFieldCollation> clusteringOrder
-
schema
private final CassandraSchema schema
-
columnFamily
private final java.lang.String columnFamily
-
view
private final boolean view
-
-
Constructor Detail
-
CassandraTable
public CassandraTable(CassandraSchema schema, java.lang.String columnFamily, boolean view)
-
CassandraTable
public CassandraTable(CassandraSchema schema, java.lang.String columnFamily)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getRowType
public RelDataType getRowType(RelDataTypeFactory typeFactory)
Description copied from interface:Table
Returns this table's row type.This is a struct type whose fields describe the names and types of the columns in this table.
The implementer must use the type factory provided. This ensures that the type is converted into a canonical form; other equal types in the same query will use the same object.
- Specified by:
getRowType
in interfaceTable
- Parameters:
typeFactory
- Type factory with which to create the type- Returns:
- Row type
-
getKeyFields
public Pair<java.util.List<java.lang.String>,java.util.List<java.lang.String>> getKeyFields()
-
getClusteringOrder
public java.util.List<RelFieldCollation> getClusteringOrder()
-
query
public Enumerable<java.lang.Object> query(com.datastax.driver.core.Session session)
-
query
public Enumerable<java.lang.Object> query(com.datastax.driver.core.Session session, java.util.List<java.util.Map.Entry<java.lang.String,java.lang.Class>> fields, java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> selectFields, java.util.List<java.lang.String> predicates, java.util.List<java.lang.String> order, java.lang.Integer offset, java.lang.Integer fetch)
Executes a CQL query on the underlying table.- Parameters:
session
- Cassandra sessionfields
- List of fields to projectpredicates
- A list of predicates which should be used in the query- Returns:
- Enumerator of results
-
asQueryable
public <T> Queryable<T> asQueryable(QueryProvider queryProvider, SchemaPlus schema, java.lang.String tableName)
Description copied from interface:QueryableTable
Converts this table into aQueryable
.- Specified by:
asQueryable
in interfaceQueryableTable
-
toRel
public RelNode toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable)
Description copied from interface:TranslatableTable
Converts this table into arelational expression
.- Specified by:
toRel
in interfaceTranslatableTable
-
-