Class ColumnRWHelper
java.lang.Object
org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnRWHelper
A set of utility functions that read or read to a column.
This class is meant to be used only by explicit Columns,
and not directly to write by clients.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectreadResult(org.apache.hadoop.hbase.client.Result result, byte[] columnFamilyBytes, byte[] columnQualifierBytes, org.apache.hadoop.yarn.server.timelineservice.storage.common.ValueConverter converter) Get the latest version of this specified column.static ObjectreadResult(org.apache.hadoop.hbase.client.Result result, org.apache.hadoop.yarn.server.timelineservice.storage.common.Column<?> column) Get the latest version of this specified column.static ObjectreadResult(org.apache.hadoop.hbase.client.Result result, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, String qualifier) Get the latest version of this specified column.readResults(org.apache.hadoop.hbase.client.Result result, byte[] columnFamilyBytes, byte[] columnPrefixBytes, org.apache.hadoop.yarn.server.timelineservice.storage.common.KeyConverter<K> keyConverter, org.apache.hadoop.yarn.server.timelineservice.storage.common.ValueConverter valueConverter) readResults(org.apache.hadoop.hbase.client.Result result, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, org.apache.hadoop.yarn.server.timelineservice.storage.common.KeyConverter<K> keyConverter) static <K,V> NavigableMap<K, NavigableMap<Long, V>> readResultsWithTimestamps(org.apache.hadoop.hbase.client.Result result, byte[] columnFamilyBytes, byte[] columnPrefixBytes, org.apache.hadoop.yarn.server.timelineservice.storage.common.KeyConverter<K> keyConverter, org.apache.hadoop.yarn.server.timelineservice.storage.common.ValueConverter valueConverter, boolean supplementTs) static <K,V> NavigableMap<K, NavigableMap<Long, V>> readResultsWithTimestamps(org.apache.hadoop.hbase.client.Result result, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, org.apache.hadoop.yarn.server.timelineservice.storage.common.KeyConverter<K> keyConverter) static voidstore(byte[] rowKey, TypedBufferedMutator<?> tableMutator, byte[] columnFamilyBytes, byte[] columnQualifier, Long timestamp, boolean supplementTs, Object inputValue, org.apache.hadoop.yarn.server.timelineservice.storage.common.ValueConverter converter, org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute... attributes) Sends a Mutation to the table.static voidstore(byte[] rowKey, TypedBufferedMutator<?> tableMutator, org.apache.hadoop.yarn.server.timelineservice.storage.common.Column<?> column, Long timestamp, Object inputValue, org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute... attributes) Sends a Mutation to the table.static voidstore(byte[] rowKey, TypedBufferedMutator<?> tableMutator, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, byte[] qualifier, Long timestamp, Object inputValue, org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute... attributes) Sends a Mutation to the table.static voidstore(byte[] rowKey, TypedBufferedMutator<?> tableMutator, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, String qualifier, Long timestamp, Object inputValue, org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute... attributes) Sends a Mutation to the table.
-
Method Details
-
store
public static void store(byte[] rowKey, TypedBufferedMutator<?> tableMutator, org.apache.hadoop.yarn.server.timelineservice.storage.common.Column<?> column, Long timestamp, Object inputValue, org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute... attributes) throws IOException Sends a Mutation to the table. The mutations will be buffered and sent over the wire as part of a batch.- Parameters:
rowKey- identifying the row to write. Nothing gets written when null.tableMutator- used to modify the underlying HBase tablecolumn- the column that is to be modifiedtimestamp- version timestamp. When null the current timestamp multiplied with TimestampGenerator.TS_MULTIPLIER and added with last 3 digits of app id will be usedinputValue- the value to write to the rowKey and column qualifier. Nothing gets written when null.attributes- Attributes to be set for HBase Put.- Throws:
IOException- if any problem occurs during store operation(sending mutation to table).
-
store
public static void store(byte[] rowKey, TypedBufferedMutator<?> tableMutator, byte[] columnFamilyBytes, byte[] columnQualifier, Long timestamp, boolean supplementTs, Object inputValue, org.apache.hadoop.yarn.server.timelineservice.storage.common.ValueConverter converter, org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute... attributes) throws IOException Sends a Mutation to the table. The mutations will be buffered and sent over the wire as part of a batch.- Parameters:
rowKey- identifying the row to write. Nothing gets written when null.tableMutator- used to modify the underlying HBase tablecolumnFamilyBytes-columnQualifier- column qualifier. Nothing gets written when null.timestamp- version timestamp. When null the current timestamp multiplied with TimestampGenerator.TS_MULTIPLIER and added with last 3 digits of app id will be usedinputValue- the value to write to the rowKey and column qualifier. Nothing gets written when null.converter-attributes- Attributes to be set for HBase Put.- Throws:
IOException- if any problem occurs during store operation(sending mutation to table).
-
readResult
public static Object readResult(org.apache.hadoop.hbase.client.Result result, byte[] columnFamilyBytes, byte[] columnQualifierBytes, org.apache.hadoop.yarn.server.timelineservice.storage.common.ValueConverter converter) throws IOException Get the latest version of this specified column. Note: this call clones the value content of the hostingCell.- Parameters:
result- from which to read the value. Cannot be nullcolumnFamilyBytes-columnQualifierBytes- referring to the column to be read.converter-- Returns:
- latest version of the specified column of whichever object was written.
- Throws:
IOException- if any problem occurs while reading result.
-
readResult
public static Object readResult(org.apache.hadoop.hbase.client.Result result, org.apache.hadoop.yarn.server.timelineservice.storage.common.Column<?> column) throws IOException Get the latest version of this specified column. Note: this call clones the value content of the hostingCell.- Parameters:
result- from which to read the value. Cannot be nullcolumn- the column that the result can be parsed to- Returns:
- latest version of the specified column of whichever object was written.
- Throws:
IOException- if any problem occurs while reading result.
-
readResult
public static Object readResult(org.apache.hadoop.hbase.client.Result result, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, String qualifier) throws IOException Get the latest version of this specified column. Note: this call clones the value content of the hostingCell.- Parameters:
result- Cannot be nullcolumnPrefix- column prefix to read fromqualifier- column qualifier. Nothing gets read when null.- Returns:
- result object (can be cast to whatever object was written to) or null when specified column qualifier for this prefix doesn't exist in the result.
- Throws:
IOException- if there is any exception encountered while reading result.
-
readResults
public static <K> Map<K,Object> readResults(org.apache.hadoop.hbase.client.Result result, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, org.apache.hadoop.yarn.server.timelineservice.storage.common.KeyConverter<K> keyConverter) throws IOException - Type Parameters:
K- identifies the type of key converter.- Parameters:
result- from which to read columns.keyConverter- used to convert column bytes to the appropriate key type- Returns:
- the latest values of columns in the column family with this prefix (or all of them if the prefix value is null).
- Throws:
IOException- if there is any exception encountered while reading results.
-
readResultsWithTimestamps
public static <K,V> NavigableMap<K,NavigableMap<Long, readResultsWithTimestampsV>> (org.apache.hadoop.hbase.client.Result result, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, org.apache.hadoop.yarn.server.timelineservice.storage.common.KeyConverter<K> keyConverter) throws IOException - Type Parameters:
K- identifies the type of key converter.V- the type of the values. The values will be cast into that type.- Parameters:
result- from which to reads data with timestamps.keyConverter- used to convert column bytes to the appropriate key type.- Returns:
- the cell values at each respective time in for form {idA={timestamp1->value1}, idA={timestamp2->value2}, idB={timestamp3->value3}, idC={timestamp1->value4}}
- Throws:
IOException- if there is any exception encountered while reading result.
-
readResultsWithTimestamps
public static <K,V> NavigableMap<K,NavigableMap<Long, readResultsWithTimestampsV>> (org.apache.hadoop.hbase.client.Result result, byte[] columnFamilyBytes, byte[] columnPrefixBytes, org.apache.hadoop.yarn.server.timelineservice.storage.common.KeyConverter<K> keyConverter, org.apache.hadoop.yarn.server.timelineservice.storage.common.ValueConverter valueConverter, boolean supplementTs) throws IOException - Type Parameters:
K- identifies the type of column name(indicated by type of key converter).V- the type of the values. The values will be cast into that type.- Parameters:
result- from which to reads data with timestampscolumnPrefixBytes- optional prefix to limit columns. If null all columns are returned.keyConverter- used to convert column bytes to the appropriate key type.- Returns:
- the cell values at each respective time in for form {idA={timestamp1->value1}, idA={timestamp2->value2}, idB={timestamp3->value3}, idC={timestamp1->value4}}
- Throws:
IOException- if any problem occurs while reading results.
-
readResults
public static <K> Map<K,Object> readResults(org.apache.hadoop.hbase.client.Result result, byte[] columnFamilyBytes, byte[] columnPrefixBytes, org.apache.hadoop.yarn.server.timelineservice.storage.common.KeyConverter<K> keyConverter, org.apache.hadoop.yarn.server.timelineservice.storage.common.ValueConverter valueConverter) throws IOException - Type Parameters:
K- identifies the type of column name(indicated by type of key converter).- Parameters:
result- from which to read columnscolumnPrefixBytes- optional prefix to limit columns. If null all columns are returned.keyConverter- used to convert column bytes to the appropriate key type.- Returns:
- the latest values of columns in the column family. If the column prefix is null, the column qualifier is returned as Strings. For a non-null column prefix bytes, the column qualifier is returned as a list of parts, each part a byte[]. This is to facilitate returning byte arrays of values that were not Strings.
- Throws:
IOException- if any problem occurs while reading results.
-
store
public static void store(byte[] rowKey, TypedBufferedMutator<?> tableMutator, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, byte[] qualifier, Long timestamp, Object inputValue, org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute... attributes) throws IOException Sends a Mutation to the table. The mutations will be buffered and sent over the wire as part of a batch.- Parameters:
rowKey- identifying the row to write. Nothing gets written when null.tableMutator- used to modify the underlying HBase table. Caller is responsible to pass a mutator for the table that actually has this column.qualifier- column qualifier. Nothing gets written when null.timestamp- version timestamp. When null the server timestamp will be used.attributes- attributes for the mutation that are used by the coprocessor to set/read the cell tags.inputValue- the value to write to the rowKey and column qualifier. Nothing gets written when null.- Throws:
IOException- if there is any exception encountered while doing store operation(sending mutation to the table).
-
store
public static void store(byte[] rowKey, TypedBufferedMutator<?> tableMutator, org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix<?> columnPrefix, String qualifier, Long timestamp, Object inputValue, org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute... attributes) throws IOException Sends a Mutation to the table. The mutations will be buffered and sent over the wire as part of a batch.- Parameters:
rowKey- identifying the row to write. Nothing gets written when null.tableMutator- used to modify the underlying HBase table. Caller is responsible to pass a mutator for the table that actually has this column.qualifier- column qualifier. Nothing gets written when null.timestamp- version timestamp. When null the server timestamp will be used.attributes- attributes for the mutation that are used by the coprocessor to set/read the cell tags.inputValue- the value to write to the rowKey and column qualifier. Nothing gets written when null.- Throws:
IOException- if there is any exception encountered while doing store operation(sending mutation to the table).
-