public class BTreeRow extends AbstractRow
Modifier and Type | Class and Description |
---|---|
static class |
BTreeRow.Builder |
Row.Deletion, Row.Merger, Row.SimpleBuilder
Unfiltered.Kind
Modifier and Type | Method and Description |
---|---|
<A> long |
accumulate(BiLongAccumulator<A,ColumnData> accumulator,
A arg,
java.util.Comparator<ColumnData> comparator,
ColumnData from,
long initialValue) |
<A> long |
accumulate(BiLongAccumulator<A,ColumnData> accumulator,
A arg,
long initialValue) |
long |
accumulate(LongAccumulator<ColumnData> accumulator,
java.util.Comparator<ColumnData> comparator,
ColumnData from,
long initialValue) |
long |
accumulate(LongAccumulator<ColumnData> accumulator,
long initialValue)
Apply an accumulation funtion to every column in a row
|
<A> void |
apply(java.util.function.BiConsumer<A,ColumnData> function,
A arg)
Apply a function to every column in a row
|
void |
apply(java.util.function.Consumer<ColumnData> function)
Apply a function to every column in a row
|
java.lang.Iterable<Cell<?>> |
cells()
An iterable over the cells of this row.
|
java.lang.Iterable<Cell<?>> |
cellsInLegacyOrder(TableMetadata metadata,
boolean reversed)
An iterable over the cells of this row that return cells in "legacy order".
|
Row |
clone(Cloner cloner) |
Clustering<?> |
clustering()
The clustering values for this row.
|
int |
columnCount()
The number of columns for which data (incl.
|
java.util.Collection<ColumnData> |
columnData()
A collection of the ColumnData representation of this row, for columns with some data (possibly not live) present
|
java.util.Collection<ColumnMetadata> |
columns()
An in-natural-order collection of the columns for which data (incl.
|
static BTreeRow |
create(Clustering<?> clustering,
LivenessInfo primaryKeyLivenessInfo,
Row.Deletion deletion,
java.lang.Object[] btree) |
static BTreeRow |
create(Clustering<?> clustering,
LivenessInfo primaryKeyLivenessInfo,
Row.Deletion deletion,
java.lang.Object[] btree,
int minDeletionTime) |
int |
dataSize() |
Row.Deletion |
deletion()
The row deletion.
|
static BTreeRow |
emptyDeletedRow(Clustering<?> clustering,
Row.Deletion deletion) |
static BTreeRow |
emptyRow(Clustering<?> clustering) |
Row |
filter(ColumnFilter filter,
DeletionTime activeDeletion,
boolean setActiveDeletionToRow,
TableMetadata metadata)
Returns a copy of this row that:
1) only includes the data for the column included by
filter . |
Row |
filter(ColumnFilter filter,
TableMetadata metadata)
Returns a copy of this row that:
1) only includes the data for the column included by
filter . |
Cell<?> |
getCell(ColumnMetadata c)
Returns a cell for a simple column.
|
Cell<?> |
getCell(ColumnMetadata c,
CellPath path)
Return a cell for a given complex column and cell path.
|
ColumnData |
getColumnData(ColumnMetadata c)
The data for a regular or complex column.
|
ComplexColumnData |
getComplexColumnData(ColumnMetadata c)
The data for a complex column.
|
boolean |
hasComplex()
Whether the row stores any (non-RT) data for any complex column.
|
boolean |
hasComplexDeletion()
Whether the row stores any (non-live) complex deletion for any complex column.
|
boolean |
hasDeletion(int nowInSec)
Whether the row has any deletion info (row deletion, cell tombstone, expired cell or complex deletion).
|
boolean |
hasInvalidDeletions()
Do a quick validation of the deletions of the unfiltered (if any)
|
boolean |
isEmpty()
Whether the row has no information whatsoever.
|
java.util.Iterator<ColumnData> |
iterator() |
Row |
markCounterLocalToBeCleared()
Returns a copy of this row where all counter cells have they "local" shard marked for clearing.
|
static Row |
merge(BTreeRow existing,
BTreeRow update,
ColumnData.PostReconciliationFunction reconcileF) |
static BTreeRow |
noCellLiveRow(Clustering<?> clustering,
LivenessInfo primaryKeyLivenessInfo) |
LivenessInfo |
primaryKeyLivenessInfo()
Liveness information for the primary key columns of this row.
|
Row |
purge(DeletionPurger purger,
int nowInSec,
boolean enforceStrictLiveness)
Returns a copy of this row without any deletion info that should be purged according to
purger . |
BTreeSearchIterator<ColumnMetadata,ColumnData> |
searchIterator()
An iterator to efficiently search data for a given column.
|
void |
setValue(ColumnMetadata column,
CellPath path,
java.nio.ByteBuffer value) |
static BTreeRow |
singleCellRow(Clustering<?> clustering,
Cell<?> cell) |
static Row.Builder |
sortedBuilder() |
Row |
transform(java.util.function.Function<ColumnData,ColumnData> function) |
Row |
transformAndFilter(java.util.function.Function<ColumnData,ColumnData> function)
Requires that
function returns either null or ColumnData for the same column. |
Row |
transformAndFilter(LivenessInfo info,
Row.Deletion deletion,
java.util.function.Function<ColumnData,ColumnData> function)
Requires that
function returns either null or ColumnData for the same column. |
long |
unsharedHeapSizeExcludingData() |
static Row.Builder |
unsortedBuilder() |
Row |
updateAllTimestamp(long newTimestamp)
Returns a copy of the row where all timestamps for live data have replaced by
newTimestamp and
all deletion timestamp by newTimestamp - 1 . |
Row |
withOnlyQueriedData(ColumnFilter filter)
Returns a copy of this row which only include the data queried by
filter , excluding anything _fetched_ for
internal reasons but not queried by the user (see ColumnFilter for details). |
Row |
withRowDeletion(DeletionTime newDeletion)
Returns a copy of this row with the new deletion as row deletion if it is more recent
than the current row deletion.
|
digest, equals, hashCode, hasLiveData, isStatic, kind, toString, toString, toString, toString, validateData
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isRangeTombstoneMarker, isRow
public static BTreeRow create(Clustering<?> clustering, LivenessInfo primaryKeyLivenessInfo, Row.Deletion deletion, java.lang.Object[] btree)
public static BTreeRow create(Clustering<?> clustering, LivenessInfo primaryKeyLivenessInfo, Row.Deletion deletion, java.lang.Object[] btree, int minDeletionTime)
public static BTreeRow emptyRow(Clustering<?> clustering)
public static BTreeRow singleCellRow(Clustering<?> clustering, Cell<?> cell)
public static BTreeRow emptyDeletedRow(Clustering<?> clustering, Row.Deletion deletion)
public static BTreeRow noCellLiveRow(Clustering<?> clustering, LivenessInfo primaryKeyLivenessInfo)
public void apply(java.util.function.Consumer<ColumnData> function)
Row
public <A> void apply(java.util.function.BiConsumer<A,ColumnData> function, A arg)
Row
public long accumulate(LongAccumulator<ColumnData> accumulator, long initialValue)
Row
public long accumulate(LongAccumulator<ColumnData> accumulator, java.util.Comparator<ColumnData> comparator, ColumnData from, long initialValue)
public <A> long accumulate(BiLongAccumulator<A,ColumnData> accumulator, A arg, long initialValue)
public <A> long accumulate(BiLongAccumulator<A,ColumnData> accumulator, A arg, java.util.Comparator<ColumnData> comparator, ColumnData from, long initialValue)
public Clustering<?> clustering()
Row
public java.util.Collection<ColumnMetadata> columns()
Row
public int columnCount()
Row
public LivenessInfo primaryKeyLivenessInfo()
Row
As a row is uniquely identified by its primary key, all its primary key columns
share the same LivenessInfo
. This liveness information is what allows us
to distinguish between a dead row (it has no live cells and its primary key liveness
info is empty) and a live row but where all non PK columns are null (it has no
live cells, but its primary key liveness is not empty). Please note that the liveness
info (including it's eventually ttl/local deletion time) only apply to the primary key
columns and has no impact on the row content.
Note in particular that a row may have live cells but no PK liveness info, because the
primary key liveness informations are only set on INSERT
(which makes sense
in itself, see #6782) but live cells can be added through UPDATE
even if the row
wasn't pre-existing (which users are encouraged not to do, but we can't validate).
public boolean isEmpty()
Row
true
if the row has no data, false
otherwise.public Row.Deletion deletion()
Row
public Cell<?> getCell(ColumnMetadata c)
Row
c
- the simple column for which to fetch the cell.null
if the row has no such cell.public Cell<?> getCell(ColumnMetadata c, CellPath path)
Row
c
- the complex column for which to fetch the cell.path
- the cell path for which to fetch the cell.null
if the row has no such cell.public ComplexColumnData getComplexColumnData(ColumnMetadata c)
Row
The returned object groups all the cells for the column, as well as it's complex deletion (if relevant).
c
- the complex column for which to return the complex data.c
or null
if the row has no data for this column.public ColumnData getColumnData(ColumnMetadata c)
Row
c
- the column for which to return the complex data.c
or null
if the row has no data for this column.public java.util.Collection<ColumnData> columnData()
Row
The data is returned in column order.
public java.util.Iterator<ColumnData> iterator()
public java.lang.Iterable<Cell<?>> cells()
Row
The iterable guarantees that cells are returned in order of Cell.comparator
.
public BTreeSearchIterator<ColumnMetadata,ColumnData> searchIterator()
Row
public Row filter(ColumnFilter filter, TableMetadata metadata)
Row
filter
.
2) doesn't include any data that belongs to a dropped column (recorded in metadata
).public Row filter(ColumnFilter filter, DeletionTime activeDeletion, boolean setActiveDeletionToRow, TableMetadata metadata)
Row
filter
.
2) doesn't include any data that belongs to a dropped column (recorded in metadata
).
3) doesn't include any data that is shadowed/deleted by activeDeletion
.
4) uses activeDeletion
as row deletion iff setActiveDeletionToRow
and activeDeletion
supersedes the row deletion.public Row withOnlyQueriedData(ColumnFilter filter)
Row
filter
, excluding anything _fetched_ for
internal reasons but not queried by the user (see ColumnFilter
for details).filter
- the ColumnFilter
to use when deciding what is user queried. This should be the filter
that was used when querying the row on which this method is called.public boolean hasComplex()
Row
public boolean hasComplexDeletion()
Row
public Row markCounterLocalToBeCleared()
Row
public boolean hasDeletion(int nowInSec)
Row
nowInSec
- the current time in seconds to decid if a cell is expired.public boolean hasInvalidDeletions()
Unfiltered
hasInvalidDeletions
in interface Unfiltered
hasInvalidDeletions
in class AbstractRow
public Row updateAllTimestamp(long newTimestamp)
newTimestamp
and
all deletion timestamp by newTimestamp - 1
.
This exists for the Paxos path, see PartitionUpdate#updateAllTimestamp
for additional details.newTimestamp
- the timestamp to use for all live data in the returned row.for why we need this.
public Row withRowDeletion(DeletionTime newDeletion)
Row
WARNING: this method does not check that nothing in the row is shadowed by the provided
deletion and if that is the case, the created row will be invalid. It is thus up to the
caller to verify that this is not the case and the only reasonable use case of this is probably
when the row and the deletion comes from the same UnfilteredRowIterator
since that gives
use this guarantee.
public Row purge(DeletionPurger purger, int nowInSec, boolean enforceStrictLiveness)
Row
purger
.purger
- the DeletionPurger
to use to decide what can be purged.nowInSec
- the current time to decide what is deleted and what isn't (in the case of expired cells).enforceStrictLiveness
- whether the row should be purged if there is no PK liveness info,
normally retrieved from TableMetadata.enforceStrictLiveness()
When enforceStrictLiveness is set, rows with empty PK liveness info
and no row deletion are purged.
Currently this is only used by views with normal base column as PK column
so updates to other base columns do not make the row live when the PK column
is not live. See CASSANDRA-11500.purger
. If the purged row is empty, returns
null
.public Row transformAndFilter(LivenessInfo info, Row.Deletion deletion, java.util.function.Function<ColumnData,ColumnData> function)
Row
function
returns either null
or ColumnData
for the same column.
Returns a copy of this row that:
1) function
has been applied to the members of
2) doesn't include any null
results of function
3) has precisely the provided LivenessInfo
and Deletion
public Row transformAndFilter(java.util.function.Function<ColumnData,ColumnData> function)
Row
function
returns either null
or ColumnData
for the same column.
Returns a copy of this row that:
1) function
has been applied to the members of
2) doesn't include any null
results of function
public Row transform(java.util.function.Function<ColumnData,ColumnData> function)
public int dataSize()
public long unsharedHeapSizeExcludingData()
public static Row.Builder sortedBuilder()
public static Row.Builder unsortedBuilder()
public void setValue(ColumnMetadata column, CellPath path, java.nio.ByteBuffer value)
public java.lang.Iterable<Cell<?>> cellsInLegacyOrder(TableMetadata metadata, boolean reversed)
Row
In 3.0+, columns are sorted so that all simple columns are before all complex columns. Previously however, the cells where just sorted by the column name. This iterator return cells in that legacy order. It's only ever meaningful for backward/thrift compatibility code.
metadata
- the table this is a row of.reversed
- if cells should returned in reverse order.public static Row merge(BTreeRow existing, BTreeRow update, ColumnData.PostReconciliationFunction reconcileF)
Copyright © 2009- The Apache Software Foundation