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 class
ColumnMetadata.ClusteringOrder
static class
ColumnMetadata.Kind
The 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.WithArrayLiteral, Selectable.WithCast, Selectable.WithElementSelection, Selectable.WithFieldSelection, Selectable.WithFunction, Selectable.WithList, Selectable.WithMapOrUdt, Selectable.WithSet, Selectable.WithSliceSelection, Selectable.WithTerm, Selectable.WithTypeHint, Selectable.WithVector, Selectable.WritetimeOrTTL
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<java.lang.Object>
asymmetricColumnDataComparator
ColumnMetadata.Kind
kind
static int
NO_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, ColumnMask mask)
ColumnMetadata(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type, int position, ColumnMetadata.Kind kind, ColumnMask mask)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendCqlTo(CqlBuilder builder)
void
appendNameAndOrderTo(CqlBuilder builder)
java.util.Comparator<java.lang.Object>
asymmetricCellPathComparator()
java.util.Comparator<? super Cell<?>>
cellComparator()
java.util.Comparator<CellPath>
cellPathComparator()
CellPath.Serializer
cellPathSerializer()
AbstractType<?>
cellValueType()
The type of the cell values for cell belonging to this column.static ColumnMetadata
clusteringColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type, int position)
static ColumnMetadata
clusteringColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type, int position)
ColumnMetadata.ClusteringOrder
clusteringOrder()
int
compareTo(ColumnMetadata other)
ColumnMetadata
copy()
java.lang.String
debugString()
boolean
equals(java.lang.Object o)
AbstractType<?>
getExactTypeIfKnown(java.lang.String keyspace)
The type of theSelectable
if it can be infered.ColumnMask
getMask()
int
hashCode()
boolean
isClusteringColumn()
boolean
isComplex()
boolean
isCounterColumn()
Check if column is counter type.boolean
isMasked()
boolean
isPartitionKey()
boolean
isPrimaryKeyColumn()
boolean
isRegular()
boolean
isSimple()
boolean
isStatic()
Selector.Factory
newSelectorFactory(TableMetadata table, AbstractType<?> expectedType, java.util.List<ColumnMetadata> defs, VariableSpecifications boundNames)
static ColumnMetadata
partitionKeyColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type, int position)
static ColumnMetadata
partitionKeyColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type, int position)
int
position()
boolean
processesSelection()
Checks if any processing is performed on the selected columns,false
otherwise.static ColumnMetadata
regularColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type)
static ColumnMetadata
regularColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type)
boolean
selectColumns(java.util.function.Predicate<ColumnMetadata> predicate)
Checks if thisSelectable
select columns matching the specified predicate.static ColumnMetadata
staticColumn(java.lang.String keyspace, java.lang.String table, java.lang.String name, AbstractType<?> type)
static ColumnMetadata
staticColumn(TableMetadata table, java.nio.ByteBuffer name, AbstractType<?> type)
static java.lang.String
toCQLString(java.lang.Iterable<ColumnMetadata> defs)
static java.lang.String
toCQLString(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.String
toString()
<V> void
validateCell(Cell<V> cell)
ColumnMetadata
withNewMask(ColumnMask newMask)
ColumnMetadata
withNewName(ColumnIdentifier newName)
ColumnMetadata
withNewType(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, getCompatibleTypeIfKnown, 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, @Nullable ColumnMask mask)
-
ColumnMetadata
public ColumnMetadata(java.lang.String ksName, java.lang.String cfName, ColumnIdentifier name, AbstractType<?> type, int position, ColumnMetadata.Kind kind, @Nullable ColumnMask mask)
-
-
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)
-
withNewMask
public ColumnMetadata withNewMask(@Nullable ColumnMask newMask)
-
isPartitionKey
public boolean isPartitionKey()
-
isClusteringColumn
public boolean isClusteringColumn()
-
isStatic
public boolean isStatic()
-
isMasked
public boolean isMasked()
-
isRegular
public boolean isRegular()
-
clusteringOrder
public ColumnMetadata.ClusteringOrder clusteringOrder()
-
position
public int position()
-
getMask
@Nullable public ColumnMask getMask()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classColumnSpecification
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classColumnSpecification
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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:Selectable
Checks if thisSelectable
select columns matching the specified predicate.- Specified by:
selectColumns
in interfaceSelectable
- Returns:
true
if thisSelectable
select columns matching the specified predicate,false
otherwise.
-
processesSelection
public boolean processesSelection()
Description copied from interface:Selectable
Checks if any processing is performed on the selected columns,false
otherwise.- Specified by:
processesSelection
in interfaceSelectable
- Returns:
true
if any processing is performed on the selected columns,false
otherwise.
-
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:
compareTo
in 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:
newSelectorFactory
in interfaceSelectable
- Throws:
InvalidRequestException
-
getExactTypeIfKnown
public AbstractType<?> getExactTypeIfKnown(java.lang.String keyspace)
Description copied from interface:Selectable
The type of theSelectable
if it can be infered.- Specified by:
getExactTypeIfKnown
in interfaceSelectable
- Parameters:
keyspace
- the keyspace on which the statement for which this is aSelectable
is on.- Returns:
- the type of this
Selectable
if inferrable, ornull
otherwise (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 returnnull
too).
-
-