Package org.apache.cassandra.schema
Class ColumnMetadata
- java.lang.Object
-
- org.apache.cassandra.cql3.ColumnSpecification
-
- org.apache.cassandra.schema.ColumnMetadata
-
- All Implemented Interfaces:
java.lang.Comparable<ColumnMetadata>,AssignmentTestable,Selectable
public final class ColumnMetadata extends ColumnSpecification implements Selectable, java.lang.Comparable<ColumnMetadata>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classColumnMetadata.ClusteringOrderstatic classColumnMetadata.KindThe type of CQL3 column this definition represents.-
Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable
AssignmentTestable.TestResult
-
Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.selection.Selectable
Selectable.BetweenParenthesesOrWithTuple, Selectable.Raw, Selectable.RawIdentifier, Selectable.WithCast, Selectable.WithElementSelection, Selectable.WithFieldSelection, Selectable.WithFunction, Selectable.WithList, Selectable.WithMapOrUdt, Selectable.WithSet, Selectable.WithSliceSelection, Selectable.WithTerm, Selectable.WithToJSonFunction, Selectable.WithTypeHint, Selectable.WritetimeOrTTL
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<java.lang.Object>asymmetricColumnDataComparatorColumnMetadata.Kindkindstatic intNO_POSITION-
Fields inherited from class org.apache.cassandra.cql3.ColumnSpecification
cfName, ksName, name, type
-
-
Constructor Summary
Constructors Constructor Description ColumnMetadata(java.lang.String ksName, java.lang.String cfName, ColumnIdentifier name, AbstractType<?> type, int position, ColumnMetadata.Kind kind)ColumnMetadata(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type, int position, ColumnMetadata.Kind kind)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendCqlTo(CqlBuilder builder)voidappendNameAndOrderTo(CqlBuilder builder)java.util.Comparator<java.lang.Object>asymmetricCellPathComparator()java.util.Comparator<? super Cell<?>>cellComparator()java.util.Comparator<CellPath>cellPathComparator()CellPath.SerializercellPathSerializer()AbstractType<?>cellValueType()The type of the cell values for cell belonging to this column.static ColumnMetadataclusteringColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type, int position)static ColumnMetadataclusteringColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type, int position)ColumnMetadata.ClusteringOrderclusteringOrder()intcompareTo(ColumnMetadata other)ColumnMetadatacopy()java.lang.StringdebugString()booleanequals(java.lang.Object o)AbstractType<?>getExactTypeIfKnown(java.lang.String keyspace)The type of theSelectableif it can be infered.inthashCode()booleanisClusteringColumn()booleanisComplex()booleanisCounterColumn()Check if column is counter type.booleanisPartitionKey()booleanisPrimaryKeyColumn()booleanisRegular()booleanisSimple()booleanisStatic()Selector.FactorynewSelectorFactory(TableMetadata table, AbstractType<?> expectedType, java.util.List<ColumnMetadata> defs, VariableSpecifications boundNames)static ColumnMetadatapartitionKeyColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type, int position)static ColumnMetadatapartitionKeyColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type, int position)intposition()booleanprocessesSelection()Checks if any processing is performed on the selected columns,falseotherwise.static ColumnMetadataregularColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type)static ColumnMetadataregularColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type)booleanselectColumns(java.util.function.Predicate<ColumnMetadata> predicate)Checks if thisSelectableselect columns matching the specified predicate.static ColumnMetadatastaticColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type)static ColumnMetadatastaticColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type)static java.lang.StringtoCQLString(java.lang.Iterable<ColumnMetadata> defs)static java.lang.StringtoCQLString(java.util.Iterator<ColumnMetadata> defs)static java.util.Collection<ColumnIdentifier>toIdentifiers(java.util.Collection<ColumnMetadata> definitions)Converts the specified column definitions into column identifiers.java.lang.StringtoString()<V> voidvalidateCell(Cell<V> cell)ColumnMetadatawithNewName(ColumnIdentifier newName)ColumnMetadatawithNewType(AbstractType<?> newType)-
Methods inherited from class org.apache.cassandra.cql3.ColumnSpecification
allInSameTable, isReversedType, withAlias
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.cql3.selection.Selectable
addAndGetIndex, specForElementOrSlice, testAssignment
-
-
-
-
Field Detail
-
asymmetricColumnDataComparator
public static final java.util.Comparator<java.lang.Object> asymmetricColumnDataComparator
-
NO_POSITION
public static final int NO_POSITION
- See Also:
- Constant Field Values
-
kind
public final ColumnMetadata.Kind kind
-
-
Constructor Detail
-
ColumnMetadata
public ColumnMetadata(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type, int position, ColumnMetadata.Kind kind)
-
ColumnMetadata
public ColumnMetadata(java.lang.String ksName, java.lang.String cfName, ColumnIdentifier name, AbstractType<?> type, int position, ColumnMetadata.Kind kind)
-
-
Method Detail
-
partitionKeyColumn
public static ColumnMetadata partitionKeyColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type, int position)
-
partitionKeyColumn
public static ColumnMetadata partitionKeyColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type, int position)
-
clusteringColumn
public static ColumnMetadata clusteringColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type, int position)
-
clusteringColumn
public static ColumnMetadata clusteringColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type, int position)
-
regularColumn
public static ColumnMetadata regularColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type)
-
regularColumn
public static ColumnMetadata regularColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type)
-
staticColumn
public static ColumnMetadata staticColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type)
-
staticColumn
public static ColumnMetadata staticColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type)
-
copy
public ColumnMetadata copy()
-
withNewName
public ColumnMetadata withNewName(ColumnIdentifier newName)
-
withNewType
public ColumnMetadata withNewType(AbstractType<?> newType)
-
isPartitionKey
public boolean isPartitionKey()
-
isClusteringColumn
public boolean isClusteringColumn()
-
isStatic
public boolean isStatic()
-
isRegular
public boolean isRegular()
-
clusteringOrder
public ColumnMetadata.ClusteringOrder clusteringOrder()
-
position
public int position()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classColumnSpecification
-
hashCode
public int hashCode()
- Overrides:
hashCodein classColumnSpecification
-
toString
public java.lang.String toString()
- Overrides:
toStringin classColumnSpecification
-
debugString
public java.lang.String debugString()
-
isPrimaryKeyColumn
public boolean isPrimaryKeyColumn()
-
selectColumns
public boolean selectColumns(java.util.function.Predicate<ColumnMetadata> predicate)
Description copied from interface:SelectableChecks if thisSelectableselect columns matching the specified predicate.- Specified by:
selectColumnsin interfaceSelectable- Returns:
trueif thisSelectableselect columns matching the specified predicate,falseotherwise.
-
processesSelection
public boolean processesSelection()
Description copied from interface:SelectableChecks if any processing is performed on the selected columns,falseotherwise.- Specified by:
processesSelectionin interfaceSelectable- Returns:
trueif any processing is performed on the selected columns,falseotherwise.
-
toIdentifiers
public static java.util.Collection<ColumnIdentifier> toIdentifiers(java.util.Collection<ColumnMetadata> definitions)
Converts the specified column definitions into column identifiers.- Parameters:
definitions- the column definitions to convert.- Returns:
- the column identifiers corresponding to the specified definitions
-
compareTo
public int compareTo(ColumnMetadata other)
- Specified by:
compareToin interfacejava.lang.Comparable<ColumnMetadata>
-
cellPathComparator
public java.util.Comparator<CellPath> cellPathComparator()
-
asymmetricCellPathComparator
public java.util.Comparator<java.lang.Object> asymmetricCellPathComparator()
-
cellComparator
public java.util.Comparator<? super Cell<?>> cellComparator()
-
isComplex
public boolean isComplex()
-
isSimple
public boolean isSimple()
-
cellPathSerializer
public CellPath.Serializer cellPathSerializer()
-
validateCell
public <V> void validateCell(Cell<V> cell)
-
appendCqlTo
public void appendCqlTo(CqlBuilder builder)
-
toCQLString
public static java.lang.String toCQLString(java.lang.Iterable<ColumnMetadata> defs)
-
toCQLString
public static java.lang.String toCQLString(java.util.Iterator<ColumnMetadata> defs)
-
appendNameAndOrderTo
public void appendNameAndOrderTo(CqlBuilder builder)
-
cellValueType
public AbstractType<?> cellValueType()
The type of the cell values for cell belonging to this column. This is the same than the column type, except for non-frozen collections where it's the 'valueComparator' of the collection. This method should not be used to get value type of non-frozon UDT.
-
isCounterColumn
public boolean isCounterColumn()
Check if column is counter type.
-
newSelectorFactory
public Selector.Factory newSelectorFactory(TableMetadata table, AbstractType<?> expectedType, java.util.List<ColumnMetadata> defs, VariableSpecifications boundNames) throws InvalidRequestException
- Specified by:
newSelectorFactoryin interfaceSelectable- Throws:
InvalidRequestException
-
getExactTypeIfKnown
public AbstractType<?> getExactTypeIfKnown(java.lang.String keyspace)
Description copied from interface:SelectableThe type of theSelectableif it can be infered.- Specified by:
getExactTypeIfKnownin interfaceSelectable- Parameters:
keyspace- the keyspace on which the statement for which this is aSelectableis on.- Returns:
- the type of this
Selectableif inferrable, ornullotherwise (for instance, the type isn't inferable for a bind marker. Even for literals, the exact type is not inferrable since they are valid for many different types and so this will returnnulltoo).
-
-