java.lang.Object
org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnRWHelper

public final class ColumnRWHelper extends Object
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 Type
    Method
    Description
    static Object
    readResult(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 Object
    readResult(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 Object
    readResult(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.
    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)
     
    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)
     
    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 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)
    Sends a Mutation to the table.
    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)
    Sends a Mutation to the table.
    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)
    Sends a Mutation to the table.
    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)
    Sends a Mutation to the table.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 table
      column - the column that is to be modified
      timestamp - version timestamp. When null the current timestamp multiplied with TimestampGenerator.TS_MULTIPLIER and added with last 3 digits of app id will be used
      inputValue - 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 table
      columnFamilyBytes -
      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 used
      inputValue - 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 hosting Cell.
      Parameters:
      result - from which to read the value. Cannot be null
      columnFamilyBytes -
      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 hosting Cell.
      Parameters:
      result - from which to read the value. Cannot be null
      column - 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 hosting Cell.
      Parameters:
      result - Cannot be null
      columnPrefix - column prefix to read from
      qualifier - 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,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) 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,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) 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 timestamps
      columnPrefixBytes - 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 columns
      columnPrefixBytes - 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).