Interface Selectable
-
- All Superinterfaces:
AssignmentTestable
- All Known Implementing Classes:
ColumnMetadata
,Selectable.BetweenParenthesesOrWithTuple
,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
public interface Selectable extends AssignmentTestable
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Selectable.BetweenParenthesesOrWithTuple
Selectable
forSelectable
between parentheses or tuples.static interface
Selectable.Raw
static class
Selectable.RawIdentifier
In the selection clause, the parser cannot differentiate between Maps and UDTs as a column identifier and field identifier have the same syntax.static class
Selectable.WithArrayLiteral
Selectable
for literal Lists.static class
Selectable.WithCast
static class
Selectable.WithElementSelection
Represents the selection of an element of a collection (eg.static class
Selectable.WithFieldSelection
Represents the selection of the field of a UDT (eg.static class
Selectable.WithFunction
static class
Selectable.WithList
static class
Selectable.WithMapOrUdt
Selectable
for literal Maps or UDTs.static class
Selectable.WithSet
Selectable
for literal Sets.static class
Selectable.WithSliceSelection
Represents the selection of a slice of a collection (eg.static class
Selectable.WithTerm
static class
Selectable.WithTypeHint
Selectable
for type hints (e.g.static class
Selectable.WithVector
static class
Selectable.WritetimeOrTTL
-
Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable
AssignmentTestable.TestResult
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
addAndGetIndex(ColumnMetadata def, java.util.List<ColumnMetadata> l)
default AbstractType<?>
getCompatibleTypeIfKnown(java.lang.String keyspace)
AbstractType<?>
getExactTypeIfKnown(java.lang.String keyspace)
The type of theSelectable
if it can be infered.Selector.Factory
newSelectorFactory(TableMetadata table, AbstractType<?> expectedType, java.util.List<ColumnMetadata> defs, VariableSpecifications boundNames)
default boolean
processesSelection()
Checks if any processing is performed on the selected columns,false
otherwise.boolean
selectColumns(java.util.function.Predicate<ColumnMetadata> predicate)
Checks if thisSelectable
select columns matching the specified predicate.static boolean
selectColumns(java.util.List<Selectable> selectables, java.util.function.Predicate<ColumnMetadata> predicate)
Checks if the specified Selectables select columns matching the specified predicate.default ColumnSpecification
specForElementOrSlice(Selectable selected, ColumnSpecification receiver, CollectionType.Kind kind, java.lang.String selectionType)
default AssignmentTestable.TestResult
testAssignment(java.lang.String keyspace, ColumnSpecification receiver)
-
-
-
Method Detail
-
newSelectorFactory
Selector.Factory newSelectorFactory(TableMetadata table, AbstractType<?> expectedType, java.util.List<ColumnMetadata> defs, VariableSpecifications boundNames)
-
getExactTypeIfKnown
AbstractType<?> getExactTypeIfKnown(java.lang.String keyspace)
The type of theSelectable
if it can be infered.- 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).
-
selectColumns
boolean selectColumns(java.util.function.Predicate<ColumnMetadata> predicate)
Checks if thisSelectable
select columns matching the specified predicate.- Returns:
true
if thisSelectable
select columns matching the specified predicate,false
otherwise.
-
selectColumns
static boolean selectColumns(java.util.List<Selectable> selectables, java.util.function.Predicate<ColumnMetadata> predicate)
Checks if the specified Selectables select columns matching the specified predicate.- Parameters:
selectables
- the selectables to check.- Returns:
true
if the specified Selectables select columns matching the specified predicate,false
otherwise.
-
processesSelection
default boolean processesSelection()
Checks if any processing is performed on the selected columns,false
otherwise.- Returns:
true
if any processing is performed on the selected columns,false
otherwise.
-
testAssignment
default AssignmentTestable.TestResult testAssignment(java.lang.String keyspace, ColumnSpecification receiver)
- Specified by:
testAssignment
in interfaceAssignmentTestable
- Returns:
- whether this object can be assigned to the provided receiver. We distinguish between 3 values: - EXACT_MATCH if this object is exactly of the type expected by the receiver - WEAKLY_ASSIGNABLE if this object is not exactly the expected type but is assignable nonetheless - NOT_ASSIGNABLE if it's not assignable Most caller should just call the isAssignable() method on the result, though functions have a use for testing "strong" equality to decide the most precise overload to pick when multiple could match.
-
getCompatibleTypeIfKnown
default AbstractType<?> getCompatibleTypeIfKnown(java.lang.String keyspace)
- Specified by:
getCompatibleTypeIfKnown
in interfaceAssignmentTestable
- Returns:
- A data type that can represent this, or
null
if we can't determine that type. The returned type won't necessarely be the exact type, but one that is compatible with it.
-
addAndGetIndex
default int addAndGetIndex(ColumnMetadata def, java.util.List<ColumnMetadata> l)
-
specForElementOrSlice
default ColumnSpecification specForElementOrSlice(Selectable selected, ColumnSpecification receiver, CollectionType.Kind kind, java.lang.String selectionType)
-
-