public abstract class RowFilter extends java.lang.Object implements java.lang.Iterable<RowFilter.Expression>
This corresponds to the restrictions on rows that are not handled by the query
ClusteringIndexFilter
. Some of the expressions of this filter may
be handled by a 2ndary index, and the rest is simply filtered out from the
result set (the later can only happen if the query was using ALLOW FILTERING).
Modifier and Type | Class and Description |
---|---|
static class |
RowFilter.CustomExpression
A custom index expression for use with 2i implementations which support custom syntax and which are not
necessarily linked to a single column in the base table.
|
static class |
RowFilter.Expression |
static class |
RowFilter.Serializer |
static class |
RowFilter.SimpleExpression
An expression of the form 'column' 'op' 'value'.
|
static class |
RowFilter.UserExpression
A user defined filtering expression.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.List<RowFilter.Expression> |
expressions |
static RowFilter |
NONE |
static RowFilter.Serializer |
serializer |
Modifier | Constructor and Description |
---|---|
protected |
RowFilter(java.util.List<RowFilter.Expression> expressions) |
Modifier and Type | Method and Description |
---|---|
RowFilter.SimpleExpression |
add(ColumnMetadata def,
Operator op,
java.nio.ByteBuffer value) |
void |
addCustomIndexExpression(TableMetadata metadata,
IndexMetadata targetIndex,
java.nio.ByteBuffer value) |
void |
addMapEquality(ColumnMetadata def,
java.nio.ByteBuffer key,
Operator op,
java.nio.ByteBuffer value) |
void |
addUserExpression(RowFilter.UserExpression e) |
boolean |
clusteringKeyRestrictionsAreSatisfiedBy(Clustering<?> clustering)
Returns true if all of the expressions within this filter that apply to the clustering key are satisfied by
the given Clustering, false otherwise.
|
static RowFilter |
create() |
static RowFilter |
create(int capacity) |
PartitionIterator |
filter(PartitionIterator iter,
TableMetadata metadata,
int nowInSec)
Filters the provided iterator so that only the row satisfying the expression of this filter
are included in the resulting iterator.
|
protected abstract Transformation<BaseRowIterator<?>> |
filter(TableMetadata metadata,
int nowInSec) |
UnfilteredPartitionIterator |
filter(UnfilteredPartitionIterator iter,
int nowInSec)
Filters the provided iterator so that only the row satisfying the expression of this filter
are included in the resulting iterator.
|
java.util.List<RowFilter.Expression> |
getExpressions() |
boolean |
hasExpressionOnClusteringOrRegularColumns()
Checks if some of the expressions apply to clustering or regular columns.
|
boolean |
isEmpty() |
boolean |
isSatisfiedBy(TableMetadata metadata,
DecoratedKey partitionKey,
Row row,
int nowInSec)
Whether the provided row in the provided partition satisfies this filter.
|
java.util.Iterator<RowFilter.Expression> |
iterator() |
boolean |
partitionKeyRestrictionsAreSatisfiedBy(DecoratedKey key,
AbstractType<?> keyValidator)
Returns true if all of the expressions within this filter that apply to the partition key are satisfied by
the given key, false otherwise.
|
java.lang.String |
toString() |
protected abstract RowFilter |
withNewExpressions(java.util.List<RowFilter.Expression> expressions) |
RowFilter |
without(RowFilter.Expression expression)
Returns this filter but without the provided expression.
|
RowFilter |
withoutExpressions() |
public static final RowFilter.Serializer serializer
public static final RowFilter NONE
protected final java.util.List<RowFilter.Expression> expressions
protected RowFilter(java.util.List<RowFilter.Expression> expressions)
public static RowFilter create()
public static RowFilter create(int capacity)
public RowFilter.SimpleExpression add(ColumnMetadata def, Operator op, java.nio.ByteBuffer value)
public void addMapEquality(ColumnMetadata def, java.nio.ByteBuffer key, Operator op, java.nio.ByteBuffer value)
public void addCustomIndexExpression(TableMetadata metadata, IndexMetadata targetIndex, java.nio.ByteBuffer value)
public void addUserExpression(RowFilter.UserExpression e)
public java.util.List<RowFilter.Expression> getExpressions()
public boolean hasExpressionOnClusteringOrRegularColumns()
true
if some of the expressions apply to clustering or regular columns, false
otherwise.protected abstract Transformation<BaseRowIterator<?>> filter(TableMetadata metadata, int nowInSec)
public UnfilteredPartitionIterator filter(UnfilteredPartitionIterator iter, int nowInSec)
iter
- the iterator to filternowInSec
- the time of query in seconds.public PartitionIterator filter(PartitionIterator iter, TableMetadata metadata, int nowInSec)
iter
- the iterator to filternowInSec
- the time of query in seconds.public boolean isSatisfiedBy(TableMetadata metadata, DecoratedKey partitionKey, Row row, int nowInSec)
metadata
- the table metadata.partitionKey
- the partition key for partition to test.row
- the row to test.nowInSec
- the current time in seconds (to know what is live and what isn't).true
if row
in partition partitionKey
satisfies this row filter.public boolean partitionKeyRestrictionsAreSatisfiedBy(DecoratedKey key, AbstractType<?> keyValidator)
public boolean clusteringKeyRestrictionsAreSatisfiedBy(Clustering<?> clustering)
public RowFilter without(RowFilter.Expression expression)
public RowFilter withoutExpressions()
protected abstract RowFilter withNewExpressions(java.util.List<RowFilter.Expression> expressions)
public boolean isEmpty()
public java.util.Iterator<RowFilter.Expression> iterator()
iterator
in interface java.lang.Iterable<RowFilter.Expression>
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2009-2022 The Apache Software Foundation