Search code examples
javahadoopmapreducehbasehadoop-yarn

The method raw() from the type Result is deprecated


In our latest upgrade of our CDH Cluster we have come accross many methods and classes which have been made deprecated.

One such case is the method raw() which I was using to get the epochTimestamp out of our Hbase table records as shown below:

String epochTimestamp = String.valueOf(values.raw()[0].getTimestamp());

My PM has asked me to get rid of all such deprecated functions and replace the same with latest.

From https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Result.html I found that listCells is the equivalent of raw(), but can anyone help me with how to obtain the epochTimestamp from HBase record using listCells?


Solution

  • As per documentation:

    public List listCells()

    Create a sorted list of the Cell's in this result. Since HBase 0.20.5 this is equivalent to raw().

    Thus your code should look:

    String epochTimestamp = String.valueOf(values.listCells().get(0).getTimestamp());