Package org.apache.cassandra.db.rows
Class UnfilteredSerializer
java.lang.Object
org.apache.cassandra.db.rows.UnfilteredSerializer
Serialize/deserialize a single Unfiltered (both on-wire and on-disk).
The encoded format for an unfiltered is <flags>(<row>|<marker>) where:
-
<flags>is a byte (or two) whose bits are flags used by the rest of the serialization. Each flag is defined/explained below as the "Unfiltered flags" constants. One of those flags is an extension flag, and if present, indicates the presence of a 2ndbyte that contains more flags. If the extension is not set, defaults are assumed for the flags of that 2nd byte. -
<row>is<clustering><sizes>[<pkliveness>][<deletion>][<columns>]<columns_data>where:<clustering>is the row clustering as serialized byClustering.Serializer(note that static row are an exception and don't have this).<sizes>are the sizes of the whole unfiltered on disk and of the previous unfiltered. This is only present for sstables and is used to efficiently skip rows (both forward and backward).<pkliveness>is the row primary key liveness infos, and it contains the timestamp, ttl and local deletion time of that info, though some/all of those can be absent based on the flags.deletionis the row deletion. It's presence is determined by the flags and if present, it conists of both the deletion timestamp and local deletion time.<columns>are the columns present in the row encoded byColumns.Serializer.serializeSubset(java.util.Collection<org.apache.cassandra.schema.ColumnMetadata>, org.apache.cassandra.db.Columns, org.apache.cassandra.io.util.DataOutputPlus). It is absent if the row contains all the columns of theSerializationHeader(which is then indicated by a flag).<columns_data>is the data for each of the column present in the row. The encoding of each data depends on whether the data is for a simple or complex column:- Simple columns are simply encoded as one
<cell> - Complex columns are encoded as
[<delTime>]<n><cell1>...<celln>where<delTime>is the deletion for this complex column (if flags indicates its presence),<n>is the vint encoded value of n, i.e.<celln>'s 1-based inde and<celli>are the<cell>for this complex column
- Simple columns are simply encoded as one
-
<marker>is<bound><deletion>where<bound>is the marker bound as serialized byClusteringBoundOrBoundary.Serializerand<deletion>is the marker deletion time.
The serialization of a <cell> is defined by Cell.Serializer.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(DataInputPlus in, SerializationHeader header, DeserializationHelper helper, Row.Builder builder) Deserialize anUnfilteredfrom the provided input.deserializeMarkerBody(DataInputPlus in, SerializationHeader header, ClusteringBoundOrBoundary<?> bound) deserializeRowBody(DataInputPlus in, SerializationHeader header, DeserializationHelper helper, int flags, int extendedFlags, Row.Builder builder) deserializeStaticRow(DataInputPlus in, SerializationHeader header, DeserializationHelper helper) deserializeTombstonesOnly(FileDataInput in, SerializationHeader header, DeserializationHelper helper) static booleanhasExtendedFlags(Row row) static booleanisEndOfPartition(int flags) static booleanisStatic(int extendedFlags) static Unfiltered.Kindkind(int flags) static intreadExtendedFlags(DataInputPlus in, int flags) voidserialize(Unfiltered unfiltered, SerializationHelper helper, DataOutputPlus out, int version) voidserialize(Unfiltered unfiltered, SerializationHelper helper, DataOutputPlus out, long previousUnfilteredSize, int version) longserializedSize(Unfiltered unfiltered, SerializationHelper helper, int version) longserializedSize(Unfiltered unfiltered, SerializationHelper helper, long previousUnfilteredSize, int version) longvoidserializeStaticRow(Row row, SerializationHelper helper, DataOutputPlus out, int version) voidvoidvoidskipStaticRow(DataInputPlus in, SerializationHeader header, DeserializationHelper helper) void
-
Field Details
-
serializer
-
-
Constructor Details
-
UnfilteredSerializer
public UnfilteredSerializer()
-
-
Method Details
-
serialize
public void serialize(Unfiltered unfiltered, SerializationHelper helper, DataOutputPlus out, int version) throws IOException - Throws:
IOException
-
serialize
public void serialize(Unfiltered unfiltered, SerializationHelper helper, DataOutputPlus out, long previousUnfilteredSize, int version) throws IOException - Throws:
IOException
-
serializeStaticRow
public void serializeStaticRow(Row row, SerializationHelper helper, DataOutputPlus out, int version) throws IOException - Throws:
IOException
-
serializedSize
-
serializedSize
public long serializedSize(Unfiltered unfiltered, SerializationHelper helper, long previousUnfilteredSize, int version) -
writeEndOfPartition
- Throws:
IOException
-
serializedSizeEndOfPartition
public long serializedSizeEndOfPartition() -
deserialize
public Unfiltered deserialize(DataInputPlus in, SerializationHeader header, DeserializationHelper helper, Row.Builder builder) throws IOException Deserialize anUnfilteredfrom the provided input.- Parameters:
in- the input from which to deserialize.header- serialization header corresponding to the serialized data.helper- the helper to use for deserialization.builder- a row builder, passed here so we don't allocate a new one for every new row.- Returns:
- the deserialized
Unfilteredornullif we've read the end of a partition. This method is guaranteed to never return empty rows. - Throws:
IOException
-
deserializeTombstonesOnly
public Unfiltered deserializeTombstonesOnly(FileDataInput in, SerializationHeader header, DeserializationHelper helper) throws IOException - Throws:
IOException
-
deserializeStaticRow
public Row deserializeStaticRow(DataInputPlus in, SerializationHeader header, DeserializationHelper helper) throws IOException - Throws:
IOException
-
deserializeMarkerBody
public RangeTombstoneMarker deserializeMarkerBody(DataInputPlus in, SerializationHeader header, ClusteringBoundOrBoundary<?> bound) throws IOException - Throws:
IOException
-
deserializeRowBody
public Row deserializeRowBody(DataInputPlus in, SerializationHeader header, DeserializationHelper helper, int flags, int extendedFlags, Row.Builder builder) throws IOException - Throws:
IOException
-
skipRowBody
- Throws:
IOException
-
skipStaticRow
public void skipStaticRow(DataInputPlus in, SerializationHeader header, DeserializationHelper helper) throws IOException - Throws:
IOException
-
skipMarkerBody
- Throws:
IOException
-
isEndOfPartition
public static boolean isEndOfPartition(int flags) -
kind
-
isStatic
public static boolean isStatic(int extendedFlags) -
readExtendedFlags
- Throws:
IOException
-
hasExtendedFlags
-