public class TableMetadata extends java.lang.Object implements SchemaElement
Modifier and Type | Class and Description |
---|---|
static class |
TableMetadata.Builder |
static class |
TableMetadata.CompactTableMetadata |
static class |
TableMetadata.Flag |
static class |
TableMetadata.Kind |
SchemaElement.SchemaElementType
Modifier and Type | Field and Description |
---|---|
protected com.google.common.collect.ImmutableList<ColumnMetadata> |
clusteringColumns |
ClusteringComparator |
comparator |
com.google.common.collect.ImmutableMap<java.nio.ByteBuffer,DroppedColumn> |
droppedColumns |
com.google.common.collect.ImmutableSet<TableMetadata.Flag> |
flags |
TableId |
id |
Indexes |
indexes |
java.lang.String |
keyspace |
TableMetadata.Kind |
kind |
java.lang.String |
name |
TableParams |
params |
IPartitioner |
partitioner |
protected com.google.common.collect.ImmutableList<ColumnMetadata> |
partitionKeyColumns |
AbstractType<?> |
partitionKeyType |
protected RegularAndStaticColumns |
regularAndStaticColumns |
DataResource |
resource |
Triggers |
triggers |
NAME_COMPARATOR
Modifier | Constructor and Description |
---|---|
protected |
TableMetadata(TableMetadata.Builder builder) |
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<ColumnMetadata> |
allColumnsInCreateOrder()
Returns an iterator over all column definitions that respect the order of the CREATE statement.
|
java.util.Iterator<ColumnMetadata> |
allColumnsInSelectOrder() |
void |
appendCqlTo(CqlBuilder builder,
boolean includeDroppedColumns,
boolean withInternals,
boolean ifNotExists) |
static TableMetadata.Builder |
builder(java.lang.String keyspace,
java.lang.String table) |
static TableMetadata.Builder |
builder(java.lang.String keyspace,
java.lang.String table,
TableId id) |
com.google.common.collect.ImmutableList<ColumnMetadata> |
clusteringColumns() |
com.google.common.collect.ImmutableCollection<ColumnMetadata> |
columns() |
java.lang.String |
elementKeyspace()
Returns the CQL name of the keyspace to which this schema element belong.
|
java.lang.String |
elementName()
Returns the CQL name of this schema element.
|
SchemaElement.SchemaElementType |
elementType()
Return the schema element type
|
boolean |
enforceStrictLiveness()
A table with strict liveness filters/ignores rows without PK liveness info,
effectively tying the row liveness to its primary key liveness.
|
boolean |
equals(java.lang.Object o) |
protected void |
except(java.lang.String format,
java.lang.Object... args) |
ColumnMetadata |
getColumn(java.nio.ByteBuffer name) |
ColumnMetadata |
getColumn(ColumnIdentifier name)
Returns the ColumnMetadata for
name . |
ColumnMetadata |
getDroppedColumn(java.nio.ByteBuffer name) |
ColumnMetadata |
getDroppedColumn(java.nio.ByteBuffer name,
boolean isStatic)
Returns a "fake" ColumnMetadata corresponding to the dropped column
name
of null if there is no such dropped column. |
ColumnMetadata |
getExistingColumn(ColumnIdentifier name)
Returns the column of the provided name if it exists, but throws a user-visible exception if that column doesn't
exist.
|
java.util.Set<java.nio.ByteBuffer> |
getReferencedUserTypes()
Returns the names of all the user types referenced by this table.
|
int |
hashCode() |
boolean |
hasStaticColumns() |
java.util.Optional<java.lang.String> |
indexName() |
java.lang.String |
indexTableName(IndexMetadata info)
Generate a table name for an index corresponding to the given column.
|
boolean |
isCompactTable() |
boolean |
isCounter() |
boolean |
isIndex() |
boolean |
isStaticCompactTable() |
boolean |
isView() |
boolean |
isVirtual() |
static TableMetadata |
minimal(java.lang.String keyspace,
java.lang.String name)
There is a couple of places in the code where we need a TableMetadata object and don't have one readily available
and know that only the keyspace and name matter.
|
ClusteringComparator |
partitionKeyAsClusteringComparator() |
java.lang.String |
partitionKeyAsCQLLiteral(java.nio.ByteBuffer partitionKey)
Returns a string representation of a partition in a CQL-friendly format.
|
com.google.common.collect.ImmutableList<ColumnMetadata> |
partitionKeyColumns() |
java.lang.String |
primaryKeyAsCQLLiteral(java.nio.ByteBuffer partitionKey,
Clustering<?> clustering)
Returns a string representation of a primary key in a CQL-friendly format.
|
java.lang.Iterable<ColumnMetadata> |
primaryKeyColumns() |
RegularAndStaticColumns |
regularAndStaticColumns() |
Columns |
regularColumns() |
Columns |
staticColumns() |
java.lang.String |
toCqlString(boolean withInternals,
boolean ifNotExists)
Returns a CQL representation of this element
|
java.lang.String |
toCqlString(boolean includeDroppedColumns,
boolean withInternals,
boolean ifNotExists) |
java.lang.String |
toDebugString() |
java.lang.String |
toString() |
TableMetadata.Builder |
unbuild() |
TableMetadata |
updateIndexTableMetadata(TableParams baseTableParams) |
void |
validate() |
TableMetadata |
withSwapped(Indexes indexes) |
TableMetadata |
withSwapped(java.util.Set<TableMetadata.Flag> flags) |
TableMetadata |
withSwapped(TableParams params) |
TableMetadata |
withSwapped(Triggers triggers) |
TableMetadata |
withUpdatedUserType(UserType udt) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
elementKeyspaceQuotedIfNeeded, elementNameQuotedIfNeeded
public final java.lang.String keyspace
public final java.lang.String name
public final TableId id
public final IPartitioner partitioner
public final TableMetadata.Kind kind
public final TableParams params
public final com.google.common.collect.ImmutableSet<TableMetadata.Flag> flags
public final com.google.common.collect.ImmutableMap<java.nio.ByteBuffer,DroppedColumn> droppedColumns
protected final com.google.common.collect.ImmutableList<ColumnMetadata> partitionKeyColumns
protected final com.google.common.collect.ImmutableList<ColumnMetadata> clusteringColumns
protected final RegularAndStaticColumns regularAndStaticColumns
public final Indexes indexes
public final Triggers triggers
public final AbstractType<?> partitionKeyType
public final ClusteringComparator comparator
public final DataResource resource
protected TableMetadata(TableMetadata.Builder builder)
public static TableMetadata.Builder builder(java.lang.String keyspace, java.lang.String table)
public static TableMetadata.Builder builder(java.lang.String keyspace, java.lang.String table, TableId id)
public TableMetadata.Builder unbuild()
public boolean isIndex()
public TableMetadata withSwapped(TableParams params)
public TableMetadata withSwapped(java.util.Set<TableMetadata.Flag> flags)
public TableMetadata withSwapped(Triggers triggers)
public TableMetadata withSwapped(Indexes indexes)
public boolean isView()
public boolean isVirtual()
public java.util.Optional<java.lang.String> indexName()
public boolean isCounter()
public boolean isCompactTable()
public boolean isStaticCompactTable()
public com.google.common.collect.ImmutableCollection<ColumnMetadata> columns()
public java.lang.Iterable<ColumnMetadata> primaryKeyColumns()
public com.google.common.collect.ImmutableList<ColumnMetadata> partitionKeyColumns()
public com.google.common.collect.ImmutableList<ColumnMetadata> clusteringColumns()
public RegularAndStaticColumns regularAndStaticColumns()
public Columns regularColumns()
public Columns staticColumns()
public java.util.Iterator<ColumnMetadata> allColumnsInSelectOrder()
public java.util.Iterator<ColumnMetadata> allColumnsInCreateOrder()
public ColumnMetadata getColumn(ColumnIdentifier name)
name
.public ColumnMetadata getExistingColumn(ColumnIdentifier name)
This method is for finding columns from a name provided by the user, and as such it does _not_ returne hidden columns (throwing that the column is unknown instead).
name
- the name of an existing non-hidden column of this table.name
.InvalidRequestException
- if there is no non-hidden column named name
in this table.public ColumnMetadata getColumn(java.nio.ByteBuffer name)
public ColumnMetadata getDroppedColumn(java.nio.ByteBuffer name)
public ColumnMetadata getDroppedColumn(java.nio.ByteBuffer name, boolean isStatic)
name
of null
if there is no such dropped column.name
- - the column nameisStatic
- - whether the column was a static column, if knownpublic boolean hasStaticColumns()
public void validate()
public ClusteringComparator partitionKeyAsClusteringComparator()
public java.lang.String indexTableName(IndexMetadata info)
info
- A definition of the column with indexpublic static TableMetadata minimal(java.lang.String keyspace, java.lang.String name)
public TableMetadata updateIndexTableMetadata(TableParams baseTableParams)
public TableMetadata withUpdatedUserType(UserType udt)
protected void except(java.lang.String format, java.lang.Object... args)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toDebugString()
public boolean enforceStrictLiveness()
public java.util.Set<java.nio.ByteBuffer> getReferencedUserTypes()
public SchemaElement.SchemaElementType elementType()
SchemaElement
elementType
in interface SchemaElement
public java.lang.String elementKeyspace()
SchemaElement
elementKeyspace
in interface SchemaElement
public java.lang.String elementName()
SchemaElement
elementName
in interface SchemaElement
public java.lang.String toCqlString(boolean withInternals, boolean ifNotExists)
SchemaElement
toCqlString
in interface SchemaElement
withInternals
- if the internals part of the CQL should be exposed.ifNotExists
- if "IF NOT EXISTS" should be included.public java.lang.String toCqlString(boolean includeDroppedColumns, boolean withInternals, boolean ifNotExists)
public void appendCqlTo(CqlBuilder builder, boolean includeDroppedColumns, boolean withInternals, boolean ifNotExists)
public java.lang.String partitionKeyAsCQLLiteral(java.nio.ByteBuffer partitionKey)
CQL3Type.toCQLLiteral(java.nio.ByteBuffer, org.apache.cassandra.transport.ProtocolVersion)
applied to the partition key.
For composite types it applies CQL3Type.toCQLLiteral(java.nio.ByteBuffer, org.apache.cassandra.transport.ProtocolVersion)
to each subkey and
combines the results into a tuple.partitionKey
- a partition keypublic java.lang.String primaryKeyAsCQLLiteral(java.nio.ByteBuffer partitionKey, Clustering<?> clustering)
partitionKey
- the partition key part of the primary keyclustering
- the clustering key part of the primary keyCopyright © 2009- The Apache Software Foundation