public abstract class ColumnFilter
extends java.lang.Object
SELECT *
query, we want to query all columns, and _fetched_ == _queried.
As this is a common case, we special case it by using a specific subclass for it.
For complex columns, this class optionally allows to specify a subset of the cells to query for each column.
We can either select individual cells by path name, or a slice of them. Note that this is a sub-selection of
_queried_ cells, so if _fetched_ != _queried_, then the cell selected by this sub-selection are considered
queried and the other ones are considered fetched (and if a column has some sub-selection, it must be a queried
column, which is actually enforced by the Builder below).Modifier and Type | Class and Description |
---|---|
static class |
ColumnFilter.Builder
A builder for a
ColumnFilter object. |
static class |
ColumnFilter.SelectionColumnFilter
ColumnFilter sub-class for queries with selected columns. |
static class |
ColumnFilter.Serializer |
static class |
ColumnFilter.Tester |
static class |
ColumnFilter.WildCardColumnFilter
ColumnFilter sub-class for wildcard queries. |
Modifier and Type | Field and Description |
---|---|
static ColumnFilter |
NONE |
static ColumnFilter.Serializer |
serializer |
Constructor and Description |
---|
ColumnFilter() |
Modifier and Type | Method and Description |
---|---|
static ColumnFilter |
all(TableMetadata metadata)
A filter that includes all columns for the provided table.
|
abstract boolean |
allFetchedColumnsAreQueried()
Whether _fetched_ == _queried_ for this filter, and so if the
isQueried() methods
can return false for some column/cell. |
static ColumnFilter.Builder |
allRegularColumnsBuilder(TableMetadata metadata,
boolean returnStaticContentOnPartitionWithNoRows)
Returns a
ColumnFilter builder that fetches all regular columns or all columns (and queries the columns
added to the builder, or everything if no column is added). |
abstract boolean |
fetchedCellIsQueried(ColumnMetadata column,
CellPath path)
Whether the provided complex cell (identified by its column and path), which is assumed to be _fetched_ by
this filter, is also _queried_ by the user.
|
abstract boolean |
fetchedColumnIsQueried(ColumnMetadata column)
Whether the provided column, which is assumed to be _fetched_ by this filter (so the caller must guarantee
that
fetches(column) == true , is also _queried_ by the user. |
abstract RegularAndStaticColumns |
fetchedColumns()
The columns that needs to be fetched internally for this filter.
|
abstract boolean |
fetches(ColumnMetadata column)
Whether the provided column is fetched by this filter.
|
abstract boolean |
fetchesAllColumns(boolean isStatic)
Whether all the (regular or static) columns are fetched by this filter.
|
boolean |
isWildcard()
Checks if this
ColumnFilter is for a wildcard query. |
abstract ColumnFilter.Tester |
newTester(ColumnMetadata column)
Creates a new
Tester to efficiently test the inclusion of cells of complex column
column . |
abstract RegularAndStaticColumns |
queriedColumns()
The columns actually queried by the user.
|
static ColumnFilter |
selection(RegularAndStaticColumns columns)
A filter that only fetches/queries the provided columns.
|
static ColumnFilter |
selection(TableMetadata metadata,
RegularAndStaticColumns queried,
boolean returnStaticContentOnPartitionWithNoRows)
A filter that fetches all columns for the provided table, but returns
only the queried ones.
|
static ColumnFilter.Builder |
selectionBuilder()
Returns a
ColumnFilter builder that only fetches the columns/cells added to the builder. |
protected abstract com.google.common.collect.SortedSetMultimap<ColumnIdentifier,ColumnSubselection> |
subSelections()
Returns the sub-selections or
null if there are none. |
abstract java.lang.String |
toCQLString()
Returns the CQL string corresponding to this
ColumnFilter . |
public static final ColumnFilter NONE
public static final ColumnFilter.Serializer serializer
public static ColumnFilter all(TableMetadata metadata)
public static ColumnFilter selection(RegularAndStaticColumns columns)
Note that this shouldn't be used for CQL queries in general as all columns should be queried to preserve CQL semantic (see class javadoc). This is ok for some internal queries however (and for #6588 if/when we implement it).
public static ColumnFilter selection(TableMetadata metadata, RegularAndStaticColumns queried, boolean returnStaticContentOnPartitionWithNoRows)
public abstract RegularAndStaticColumns fetchedColumns()
public abstract RegularAndStaticColumns queriedColumns()
Note that this is in general not all the columns that are fetched internally (see fetchedColumns()
).
public abstract boolean fetchesAllColumns(boolean isStatic)
Note that this method is meant as an optimization but a negative return
shouldn't be relied upon strongly: this can return false
but
still have all the columns fetches if those were manually selected by the
user. The goal here is to cheaply avoid filtering things on wildcard
queries, as those are common.
isStatic
- whether to check for static columns or not. If true
,
the method returns if all static columns are fetched, otherwise it checks
regular columns.public abstract boolean allFetchedColumnsAreQueried()
isQueried()
methods
can return false
for some column/cell.public abstract boolean fetches(ColumnMetadata column)
public abstract boolean fetchedColumnIsQueried(ColumnMetadata column)
fetches(column) == true
, is also _queried_ by the user.
!WARNING! please be sure to understand the difference between _fetched_ and _queried_
columns that this class made before using this method. If unsure, you probably want
to use the fetches(org.apache.cassandra.schema.ColumnMetadata)
method.public abstract boolean fetchedCellIsQueried(ColumnMetadata column, CellPath path)
fetches(org.apache.cassandra.schema.ColumnMetadata)
method.@Nullable public abstract ColumnFilter.Tester newTester(ColumnMetadata column)
Tester
to efficiently test the inclusion of cells of complex column
column
.column
- for complex column for which to create a tester.null
if all the cells from the provided column
are queried.public boolean isWildcard()
ColumnFilter
is for a wildcard query.true
if this ColumnFilter
is for a wildcard query, false
otherwise.public abstract java.lang.String toCQLString()
ColumnFilter
.ColumnFilter
.protected abstract com.google.common.collect.SortedSetMultimap<ColumnIdentifier,ColumnSubselection> subSelections()
null
if there are none.null
if there are nonepublic static ColumnFilter.Builder allRegularColumnsBuilder(TableMetadata metadata, boolean returnStaticContentOnPartitionWithNoRows)
ColumnFilter
builder that fetches all regular columns or all columns (and queries the columns
added to the builder, or everything if no column is added).metadata
- the table metadatareturnStaticContentOnPartitionWithNoRows
- true
if the query must return static contents if the partition has no row,
false
otherwise.public static ColumnFilter.Builder selectionBuilder()
ColumnFilter
builder that only fetches the columns/cells added to the builder.Copyright © 2009-2022 The Apache Software Foundation