public class CassandraDataContext extends QueryPostprocessDataContext implements DataContext
SimpleTableDef class.INFORMATION_SCHEMA_NAME, SYSTEM_PROPERTY_CREATE_DEFAULT_TABLE_ALIAS| Constructor and Description |
|---|
CassandraDataContext(com.datastax.driver.core.Cluster cluster,
String keySpace)
Constructs a
CassandraDataContext and automatically detects the
schema structure/view on the keyspace (see
detectSchema(Cluster, String)). |
CassandraDataContext(com.datastax.driver.core.Cluster cluster,
String keySpace,
SimpleTableDef... tableDefs)
Constructs a
CassandraDataContext. |
| Modifier and Type | Method and Description |
|---|---|
static SimpleTableDef[] |
detectSchema(com.datastax.driver.core.Cluster cluster,
String keyspaceName)
Performs an analysis of the given keyspace in a Cassandra cluster
Cluster instance and detects the cassandra types structure based
on the metadata provided by the datastax cassandra java client. |
static SimpleTableDef |
detectTable(com.datastax.driver.core.TableMetadata tableMetaData)
Performs an analysis of an available table in Cassandra.
|
protected Number |
executeCountQuery(Table table,
List<FilterItem> whereItems,
boolean functionApproximationAllowed)
Executes a simple count query, if possible.
|
protected Row |
executePrimaryKeyLookupQuery(Table table,
List<SelectItem> selectItems,
Column primaryKeyColumn,
Object keyValue)
Executes a query which obtains a row by primary key (as defined by
Column.isPrimaryKey()). |
protected Schema |
getMainSchema() |
protected String |
getMainSchemaName() |
protected DataSet |
materializeMainSchemaTable(Table table,
List<Column> columns,
int maxRows)
Executes a simple one-table query against a table in the main schema of the subclasses of this class.
|
addConverter, executeQuery, getDefaultSchemaName, getSchemaByNameInternal, getSchemaNamesInternal, isMainSchemaTable, isScalarFunctionMaterialized, materializeFromItem, materializeMainSchemaTable, materializeMainSchemaTable, materializeMainSchemaTableSelect, materializeTablecompileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, onSchemaCacheRefreshed, parseQuery, query, refreshSchemasclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompileQuery, executeQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, parseQuery, query, refreshSchemaspublic CassandraDataContext(com.datastax.driver.core.Cluster cluster,
String keySpace,
SimpleTableDef... tableDefs)
CassandraDataContext. This constructor accepts a
custom array of SimpleTableDefs which allows the user to define
his own view on the indexes in the engine.cluster - the Cassandra clusterkeySpace - the name of the Cassandra keyspacetableDefs - an array of SimpleTableDefs, which define the table
and column model of the ElasticSearch index.public CassandraDataContext(com.datastax.driver.core.Cluster cluster,
String keySpace)
CassandraDataContext and automatically detects the
schema structure/view on the keyspace (see
detectSchema(Cluster, String)).cluster - the Cassandra clusterkeySpace - the name of the Cassandra keyspace to representpublic static SimpleTableDef[] detectSchema(com.datastax.driver.core.Cluster cluster, String keyspaceName)
Cluster instance and detects the cassandra types structure based
on the metadata provided by the datastax cassandra java client.cluster - the cluster to inspectkeyspaceName - detectTable(TableMetadata)public static SimpleTableDef detectTable(com.datastax.driver.core.TableMetadata tableMetaData)
tableMetaData - the table meta dataprotected Schema getMainSchema() throws MetaModelException
getMainSchema in class QueryPostprocessDataContextMetaModelExceptionprotected String getMainSchemaName() throws MetaModelException
getMainSchemaName in class QueryPostprocessDataContextMetaModelExceptionprotected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows)
QueryPostprocessDataContextmaterializeMainSchemaTable in class QueryPostprocessDataContexttable - the table to querycolumns - the columns of the table to querymaxRows - the maximum amount of rows needed or -1 if all rows are wanted.protected Row executePrimaryKeyLookupQuery(Table table, List<SelectItem> selectItems, Column primaryKeyColumn, Object keyValue)
QueryPostprocessDataContextColumn.isPrimaryKey()). This method is
provided to allow subclasses to optimize lookup queries since they are quite common and often a datastore can
retrieve the row using some specialized means which is much more performant than scanning all records manually.executePrimaryKeyLookupQuery in class QueryPostprocessDataContexttable - the table on which the lookup is requested.selectItems - the items to select from the lookup query.primaryKeyColumn - the column that is the primary keykeyValue - the primary key value that is specified in the lookup query.protected Number executeCountQuery(Table table, List<FilterItem> whereItems, boolean functionApproximationAllowed)
QueryPostprocessDataContextexecuteCountQuery in class QueryPostprocessDataContexttable - the table on which the count is requested.whereItems - a (sometimes empty) list of WHERE items.functionApproximationAllowed - whether approximation is allowed or not.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.