public interface Row extends Unfiltered, java.lang.Iterable<ColumnData>
Clustering
, which holds the values for the clustering columns identifying the row.
2) Its row level informations: the primary key liveness infos and the row deletion (see
primaryKeyLivenessInfo()
and deletion()
for more details).
3) Data for the columns it contains, or in other words, it's a (sorted) collection of
ColumnData
.
Also note that as for every other storage engine object, a Row
object cannot shadow
it's own data. For instance, a Row
cannot contains a cell that is deleted by its own
row deletion.Modifier and Type | Interface and Description |
---|---|
static interface |
Row.Builder
Interface for building rows.
|
static class |
Row.Deletion
A row deletion/tombstone.
|
static class |
Row.Merger
Utility class to help merging rows from multiple inputs (UnfilteredRowIterators).
|
Unfiltered.Kind
Modifier and Type | Method and Description |
---|---|
java.lang.Iterable<Cell> |
cells()
An iterable over the cells of this row.
|
java.lang.Iterable<Cell> |
cellsInLegacyOrder(CFMetaData metadata,
boolean reversed)
An iterable over the cells of this row that return cells in "legacy order".
|
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<ColumnDefinition> |
columns()
An in-natural-order collection of the columns for which data (incl.
|
int |
dataSize() |
Row.Deletion |
deletion()
The row deletion.
|
Row |
filter(ColumnFilter filter,
CFMetaData metadata)
Returns a copy of this row that:
1) only includes the data for the column included by
filter . |
Row |
filter(ColumnFilter filter,
DeletionTime activeDeletion,
boolean setActiveDeletionToRow,
CFMetaData metadata)
Returns a copy of this row that:
1) only includes the data for the column included by
filter . |
Cell |
getCell(ColumnDefinition c)
Returns a cell for a simple column.
|
Cell |
getCell(ColumnDefinition c,
CellPath path)
Return a cell for a given complex column and cell path.
|
ComplexColumnData |
getComplexColumnData(ColumnDefinition 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 |
hasLiveData(int nowInSec,
boolean enforceStrictLiveness)
Whether the row has some live information (i.e.
|
boolean |
isEmpty()
Whether the row has no information whatsoever.
|
boolean |
isStatic()
Whether the row correspond to a static row or not.
|
Row |
markCounterLocalToBeCleared()
Returns a copy of this row where all counter cells have they "local" shard marked for clearing.
|
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 . |
SearchIterator<ColumnDefinition,ColumnData> |
searchIterator()
An iterator to efficiently search data for a given column.
|
java.lang.String |
toString(CFMetaData metadata,
boolean fullDetails) |
long |
unsharedHeapSizeExcludingData() |
Row |
updateAllTimestamp(long newTimestamp)
Returns a copy of this row where all live timestamp have been replaced by
newTimestamp and every deletion
timestamp by newTimestamp - 1 . |
Row |
withRowDeletion(DeletionTime deletion)
Returns a copy of this row with the new deletion as row deletion if it is more recent
than the current row deletion.
|
digest, isRangeTombstoneMarker, isRow, kind, toString, toString, validateData
Clustering clustering()
clustering
in interface Clusterable
java.util.Collection<ColumnDefinition> columns()
int columnCount()
Row.Deletion deletion()
LivenessInfo primaryKeyLivenessInfo()
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).
boolean isStatic()
boolean isEmpty()
isEmpty
in interface Unfiltered
true
if the row has no data, false
otherwise.boolean hasLiveData(int nowInSec, boolean enforceStrictLiveness)
nowInSec
- the current time to decide what is deleted and what isn'tenforceStrictLiveness
- whether the row should be purged if there is no PK liveness info,
normally retrieved from CFMetaData.enforceStrictLiveness()
Cell getCell(ColumnDefinition c)
c
- the simple column for which to fetch the cell.null
if the row has no such cell.Cell getCell(ColumnDefinition c, CellPath path)
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.ComplexColumnData getComplexColumnData(ColumnDefinition c)
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.java.lang.Iterable<Cell> cells()
The iterable guarantees that cells are returned in order of Cell.comparator
.
java.util.Collection<ColumnData> columnData()
The data is returned in column order.
java.lang.Iterable<Cell> cellsInLegacyOrder(CFMetaData metadata, boolean reversed)
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.boolean hasComplexDeletion()
boolean hasComplex()
boolean hasDeletion(int nowInSec)
nowInSec
- the current time in seconds to decid if a cell is expired.SearchIterator<ColumnDefinition,ColumnData> searchIterator()
Row filter(ColumnFilter filter, CFMetaData metadata)
filter
.
2) doesn't include any data that belongs to a dropped column (recorded in metadata
).Row filter(ColumnFilter filter, DeletionTime activeDeletion, boolean setActiveDeletionToRow, CFMetaData metadata)
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.Row purge(DeletionPurger purger, int nowInSec, boolean enforceStrictLiveness)
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 CFMetaData.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
.Row markCounterLocalToBeCleared()
Row updateAllTimestamp(long newTimestamp)
newTimestamp
and every deletion
timestamp by newTimestamp - 1
.newTimestamp
- the timestamp to use for all live data in the returned row.newTimestamp
. This can return null
in the
rare where the row only as a shadowable row deletion and the new timestamp supersedes it.for why we need this.
Row withRowDeletion(DeletionTime deletion)
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.
int dataSize()
long unsharedHeapSizeExcludingData()
java.lang.String toString(CFMetaData metadata, boolean fullDetails)
toString
in interface Unfiltered
Copyright © 2019 The Apache Software Foundation