Class CassandraSchema
- java.lang.Object
-
- org.apache.calcite.schema.impl.AbstractSchema
-
- org.apache.calcite.adapter.cassandra.CassandraSchema
-
- All Implemented Interfaces:
Schema
public class CassandraSchema extends AbstractSchema
Schema mapped onto a Cassandra column family
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.calcite.schema.impl.AbstractSchema
AbstractSchema.Factory
-
Nested classes/interfaces inherited from interface org.apache.calcite.schema.Schema
Schema.TableType
-
-
Field Summary
Fields Modifier and Type Field Description private static int
DEFAULT_CASSANDRA_PORT
(package private) Hook.Closeable
hook
(package private) java.lang.String
keyspace
protected static org.slf4j.Logger
LOGGER
(package private) java.lang.String
name
private SchemaPlus
parentSchema
(package private) com.datastax.driver.core.Session
session
-
Constructor Summary
Constructors Constructor Description CassandraSchema(java.lang.String host, int port, java.lang.String keyspace, java.lang.String username, java.lang.String password, SchemaPlus parentSchema, java.lang.String name)
Creates a Cassandra schema.CassandraSchema(java.lang.String host, int port, java.lang.String keyspace, SchemaPlus parentSchema, java.lang.String name)
Creates a Cassandra schema.CassandraSchema(java.lang.String host, java.lang.String keyspace, java.lang.String username, java.lang.String password, SchemaPlus parentSchema, java.lang.String name)
Creates a Cassandra schema.CassandraSchema(java.lang.String host, java.lang.String keyspace, SchemaPlus parentSchema, java.lang.String name)
Creates a Cassandra schema.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addMaterializedViews()
Add all materialized views defined in the schema to this column familyjava.util.List<RelFieldCollation>
getClusteringOrder(java.lang.String columnFamily, boolean view)
Get the collation of all clustering key columns.(package private) Pair<java.util.List<java.lang.String>,java.util.List<java.lang.String>>
getKeyFields(java.lang.String columnFamily, boolean view)
Get all primary key columns from the underlying CQL tableprivate com.datastax.driver.core.KeyspaceMetadata
getKeyspace()
(package private) RelProtoDataType
getRelDataType(java.lang.String columnFamily, boolean view)
protected java.util.Map<java.lang.String,Table>
getTableMap()
Returns a map of tables in this schema by name.-
Methods inherited from class org.apache.calcite.schema.impl.AbstractSchema
getExpression, getFunctionMultimap, getFunctionNames, getFunctions, getSubSchema, getSubSchemaMap, getSubSchemaNames, getTable, getTableNames, getType, getTypeMap, getTypeNames, isMutable, snapshot
-
-
-
-
Field Detail
-
session
final com.datastax.driver.core.Session session
-
keyspace
final java.lang.String keyspace
-
parentSchema
private final SchemaPlus parentSchema
-
name
final java.lang.String name
-
hook
final Hook.Closeable hook
-
LOGGER
protected static final org.slf4j.Logger LOGGER
-
DEFAULT_CASSANDRA_PORT
private static final int DEFAULT_CASSANDRA_PORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CassandraSchema
public CassandraSchema(java.lang.String host, java.lang.String keyspace, SchemaPlus parentSchema, java.lang.String name)
Creates a Cassandra schema.- Parameters:
host
- Cassandra host, e.g. "localhost"keyspace
- Cassandra keyspace name, e.g. "twissandra"
-
CassandraSchema
public CassandraSchema(java.lang.String host, int port, java.lang.String keyspace, SchemaPlus parentSchema, java.lang.String name)
Creates a Cassandra schema.- Parameters:
host
- Cassandra host, e.g. "localhost"port
- Cassandra port, e.g. 9042keyspace
- Cassandra keyspace name, e.g. "twissandra"
-
CassandraSchema
public CassandraSchema(java.lang.String host, java.lang.String keyspace, java.lang.String username, java.lang.String password, SchemaPlus parentSchema, java.lang.String name)
Creates a Cassandra schema.- Parameters:
host
- Cassandra host, e.g. "localhost"keyspace
- Cassandra keyspace name, e.g. "twissandra"username
- Cassandra usernamepassword
- Cassandra password
-
CassandraSchema
public CassandraSchema(java.lang.String host, int port, java.lang.String keyspace, java.lang.String username, java.lang.String password, SchemaPlus parentSchema, java.lang.String name)
Creates a Cassandra schema.- Parameters:
host
- Cassandra host, e.g. "localhost"port
- Cassandra port, e.g. 9042keyspace
- Cassandra keyspace name, e.g. "twissandra"username
- Cassandra usernamepassword
- Cassandra password
-
-
Method Detail
-
getRelDataType
RelProtoDataType getRelDataType(java.lang.String columnFamily, boolean view)
-
getKeyFields
Pair<java.util.List<java.lang.String>,java.util.List<java.lang.String>> getKeyFields(java.lang.String columnFamily, boolean view)
Get all primary key columns from the underlying CQL table- Returns:
- A list of field names that are part of the partition and clustering keys
-
getClusteringOrder
public java.util.List<RelFieldCollation> getClusteringOrder(java.lang.String columnFamily, boolean view)
Get the collation of all clustering key columns.- Returns:
- A RelCollations representing the collation of all clustering keys
-
addMaterializedViews
private void addMaterializedViews()
Add all materialized views defined in the schema to this column family
-
getTableMap
protected java.util.Map<java.lang.String,Table> getTableMap()
Description copied from class:AbstractSchema
Returns a map of tables in this schema by name.The implementations of
AbstractSchema.getTableNames()
andAbstractSchema.getTable(String)
depend on this map. The default implementation of this method returns the empty map. Override this method to change their behavior.- Overrides:
getTableMap
in classAbstractSchema
- Returns:
- Map of tables in this schema by name
-
getKeyspace
private com.datastax.driver.core.KeyspaceMetadata getKeyspace()
-
-