T - refers to the table.public class ColumnHelper<T> extends Object
| Constructor and Description |
|---|
ColumnHelper(ColumnFamily<T> columnFamily) |
ColumnHelper(ColumnFamily<T> columnFamily,
ValueConverter converter) |
ColumnHelper(ColumnFamily<T> columnFamily,
ValueConverter converter,
boolean needSupplementTs) |
| Modifier and Type | Method and Description |
|---|---|
ColumnFamily<T> |
getColumnFamily() |
static byte[] |
getColumnQualifier(byte[] columnPrefixBytes,
byte[] qualifier) |
static byte[] |
getColumnQualifier(byte[] columnPrefixBytes,
long qualifier) |
static byte[] |
getColumnQualifier(byte[] columnPrefixBytes,
String qualifier) |
ValueConverter |
getValueConverter() |
Object |
readResult(org.apache.hadoop.hbase.client.Result result,
byte[] columnQualifierBytes)
Get the latest version of this specified column.
|
<K> Map<K,Object> |
readResults(org.apache.hadoop.hbase.client.Result result,
byte[] columnPrefixBytes,
KeyConverter<K> keyConverter) |
<K,V> NavigableMap<K,NavigableMap<Long,V>> |
readResultsWithTimestamps(org.apache.hadoop.hbase.client.Result result,
byte[] columnPrefixBytes,
KeyConverter<K> keyConverter) |
void |
store(byte[] rowKey,
TypedBufferedMutator<?> tableMutator,
byte[] columnQualifier,
Long timestamp,
Object inputValue,
Attribute... attributes)
Sends a Mutation to the table.
|
public ColumnHelper(ColumnFamily<T> columnFamily)
public ColumnHelper(ColumnFamily<T> columnFamily, ValueConverter converter)
public ColumnHelper(ColumnFamily<T> columnFamily, ValueConverter converter, boolean needSupplementTs)
columnFamily - column family implementation.converter - converter use to encode/decode values stored in the column
or column prefix.needSupplementTs - flag to indicate if cell timestamp needs to be
modified for this column by calling
TimestampGenerator.getSupplementedTimestamp(long, String). This
would be required for columns(such as metrics in flow run table) where
potential collisions can occur due to same timestamp.public void store(byte[] rowKey,
TypedBufferedMutator<?> tableMutator,
byte[] columnQualifier,
Long timestamp,
Object inputValue,
Attribute... attributes)
throws IOException
rowKey - identifying the row to write. Nothing gets written when null.tableMutator - used to modify the underlying HBase tablecolumnQualifier - 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.attributes - Attributes to be set for HBase Put.IOException - if any problem occurs during store operation(sending
mutation to table).public ColumnFamily<T> getColumnFamily()
public Object readResult(org.apache.hadoop.hbase.client.Result result, byte[] columnQualifierBytes) throws IOException
Cell.result - from which to read the value. Cannot be nullcolumnQualifierBytes - referring to the column to be read.IOException - if any problem occurs while reading result.public <K,V> NavigableMap<K,NavigableMap<Long,V>> readResultsWithTimestamps(org.apache.hadoop.hbase.client.Result result, byte[] columnPrefixBytes, KeyConverter<K> keyConverter) throws IOException
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.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.IOException - if any problem occurs while reading results.public <K> Map<K,Object> readResults(org.apache.hadoop.hbase.client.Result result, byte[] columnPrefixBytes, KeyConverter<K> keyConverter) throws IOException
K - identifies the type of column name(indicated by type of key
converter).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.IOException - if any problem occurs while reading results.public static byte[] getColumnQualifier(byte[] columnPrefixBytes,
String qualifier)
columnPrefixBytes - The byte representation for the column prefix.
Should not contain Separator.QUALIFIERS.qualifier - for the remainder of the column.
Separator.QUALIFIERS is permissible in the qualifier
as it is joined only with the column prefix bytes.public static byte[] getColumnQualifier(byte[] columnPrefixBytes,
long qualifier)
columnPrefixBytes - The byte representation for the column prefix.
Should not contain Separator.QUALIFIERS.qualifier - for the remainder of the column.public ValueConverter getValueConverter()
public static byte[] getColumnQualifier(byte[] columnPrefixBytes,
byte[] qualifier)
columnPrefixBytes - The byte representation for the column prefix.
Should not contain Separator.QUALIFIERS.qualifier - the byte representation for the remainder of the column.Copyright © 2018 Apache Software Foundation. All Rights Reserved.