Class TableMetadata

    • Method Detail

      • builder

        public static TableMetadata.Builder builder​(java.lang.String keyspace,
                                                    java.lang.String table)
      • isIndex

        public boolean isIndex()
      • isView

        public boolean isView()
      • isVirtual

        public boolean isVirtual()
      • indexName

        public java.util.Optional<java.lang.String> indexName()
      • isCounter

        public boolean isCounter()
      • isCompactTable

        public boolean isCompactTable()
      • isIncrementalBackupsEnabled

        public boolean isIncrementalBackupsEnabled()
      • isStaticCompactTable

        public boolean isStaticCompactTable()
      • columns

        public com.google.common.collect.ImmutableCollection<ColumnMetadata> columns()
      • primaryKeyColumns

        public java.lang.Iterable<ColumnMetadata> primaryKeyColumns()
      • partitionKeyColumns

        public com.google.common.collect.ImmutableList<ColumnMetadata> partitionKeyColumns()
      • clusteringColumns

        public com.google.common.collect.ImmutableList<ColumnMetadata> clusteringColumns()
      • regularColumns

        public Columns regularColumns()
      • staticColumns

        public Columns staticColumns()
      • allColumnsInSelectOrder

        public java.util.Iterator<ColumnMetadata> allColumnsInSelectOrder()
      • allColumnsInCreateOrder

        public java.util.Iterator<ColumnMetadata> allColumnsInCreateOrder()
        Returns an iterator over all column definitions that respect the order of the CREATE statement.
      • getExistingColumn

        public 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.

        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).

        Parameters:
        name - the name of an existing non-hidden column of this table.
        Returns:
        the column metadata corresponding to name.
        Throws:
        InvalidRequestException - if there is no non-hidden column named name in this table.
      • getColumn

        public ColumnMetadata getColumn​(java.nio.ByteBuffer name)
      • getDroppedColumn

        public ColumnMetadata getDroppedColumn​(java.nio.ByteBuffer name)
      • getDroppedColumn

        public 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.
        Parameters:
        name - - the column name
        isStatic - - whether the column was a static column, if known
      • hasStaticColumns

        public boolean hasStaticColumns()
      • hasMaskedColumns

        public boolean hasMaskedColumns()
        Returns:
        true if the table has any masked column, false otherwise.
      • dependsOn

        public boolean dependsOn​(Function function)
        Parameters:
        function - a user function
        Returns:
        true if the table has any masked column depending on the specified user function, false otherwise.
      • validate

        public void validate()
      • validateCompatibility

        public void validateCompatibility​(TableMetadata previous)
      • partitionKeyAsClusteringComparator

        public ClusteringComparator partitionKeyAsClusteringComparator()
      • indexTableName

        public java.lang.String indexTableName​(IndexMetadata info)
        Generate a table name for an index corresponding to the given column. This is NOT the same as the index's name! This is only used in sstable filenames and is not exposed to users.
        Parameters:
        info - A definition of the column with index
        Returns:
        name of the index table
      • minimal

        public 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. This creates such "fake" metadata. Use only if you know what you're doing.
      • except

        protected void except​(java.lang.String format,
                              java.lang.Object... args)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toDebugString

        public java.lang.String toDebugString()
      • enforceStrictLiveness

        public boolean enforceStrictLiveness()
        A table with strict liveness filters/ignores rows without PK liveness info, effectively tying the row liveness to its primary key liveness. Currently this is only used by views with normal base column as PK column so updates to other columns do not make the row live when the base column is not live. See CASSANDRA-11500. TODO: does not belong here, should be gone
      • getReferencedUserTypes

        public java.util.Set<java.nio.ByteBuffer> getReferencedUserTypes()
        Returns the names of all the user types referenced by this table.
        Returns:
        the names of all the user types referenced by this table.
      • elementKeyspace

        public java.lang.String elementKeyspace()
        Description copied from interface: SchemaElement
        Returns the CQL name of the keyspace to which this schema element belong.
        Specified by:
        elementKeyspace in interface SchemaElement
        Returns:
        the keyspace name.
      • elementName

        public java.lang.String elementName()
        Description copied from interface: SchemaElement
        Returns the CQL name of this schema element.
        Specified by:
        elementName in interface SchemaElement
        Returns:
        the name of this schema element.
      • toCqlString

        public java.lang.String toCqlString​(boolean withInternals,
                                            boolean ifNotExists)
        Description copied from interface: SchemaElement
        Returns a CQL representation of this element
        Specified by:
        toCqlString in interface SchemaElement
        Parameters:
        withInternals - if the internals part of the CQL should be exposed.
        ifNotExists - if "IF NOT EXISTS" should be included.
        Returns:
        a CQL representation of this element
      • toCqlString

        public java.lang.String toCqlString​(boolean includeDroppedColumns,
                                            boolean withInternals,
                                            boolean ifNotExists)
      • appendCqlTo

        public void appendCqlTo​(CqlBuilder builder,
                                boolean includeDroppedColumns,
                                boolean withInternals,
                                boolean ifNotExists)
      • partitionKeyAsCQLLiteral

        public java.lang.String partitionKeyAsCQLLiteral​(java.nio.ByteBuffer partitionKey)
        Returns a string representation of a partition in a CQL-friendly format. For non-composite types it returns the result of CQL3Type.toCQLLiteral(java.nio.ByteBuffer) applied to the partition key. For composite types it applies CQL3Type.toCQLLiteral(java.nio.ByteBuffer) to each subkey and combines the results into a tuple.
        Parameters:
        partitionKey - a partition key
        Returns:
        CQL-like string representation of a partition key
      • primaryKeyAsCQLLiteral

        public java.lang.String primaryKeyAsCQLLiteral​(java.nio.ByteBuffer partitionKey,
                                                       Clustering<?> clustering)
        Returns a string representation of a primary key in a CQL-friendly format.
        Parameters:
        partitionKey - the partition key part of the primary key
        clustering - the clustering key part of the primary key
        Returns:
        a CQL-like string representation of the specified primary key