Hive/HBase : How to interpret data stored in HBase?
<p>I am currently working on a Hive External Table, stored on HBase.  In this task, my problem is about interpreting the data stored in HBase.</p>

<p>So, I have this table, called ‘ana’, which has a column family ‘d’ and several qualifiers. Here is an extract of my base:</p>

<hr>

<p>1GME010NE- 2015-10-15 15:43:56.822, column=d:12 , value=20151015</p>

<p>1GME010NE- 2015-10-15 15:43:56.822, column=d:13, value=15:43:56.822</p>

<p>1GME010NE- 2015-10-15 15:43:56.822, <strong>column=d:14</strong>, value=<strong>@\x80\x00\x00</strong></p>

<p>1GME010NE- 2015-10-15 15:43:56.822, column=d:15, value=0</p>

<p>1GME010NE- 2015-10-15 15:43:56.822, <strong>column=d:8</strong>,  value=<strong>\x00\x00\x01Pl,\x09\x96</strong> </p>

<p>1GME010NE- 2015-10-15 15:43:56.822,  column=d:e, value=1GME010NE-</p>

<hr>

<p>My issue come from :</p>

<ul>
<li><strong>The column d:8</strong>, which contains a <strong>BIGINT</strong>, which is indeed a <strong>TIMESTAMP</strong> equals to ‘2015-10-15 15:43:56.822’, coded as ‘\x00\x00\x01Pl,\x09\x96’. </li>
</ul>

<p>What I want is to have access, to that data, through Hive, with the BIGINT directly interpreted as a TIMESTAMP. So I tried this : </p>

<pre><code>CREATE EXTERNAL TABLE hbase_anahist
  (
     rowkey STRING,
     jour STRING,
     heure STRING,
     valeur FLOAT,
     validite STRING,
     horodate BIGINT,
     repere STRING
  )
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES
  ("hbase.columns.mapping" = ":key#s, d:12#s, d:13#s, d:14#b, d:15#s, d:8#b, d:e#$)
TBLPROPERTIES
  (
      "hbase.table.name" = "ana",
      "hbase.mapred.output.outputtable" = "ana",
      "hbase.table.default.storage.type"="binary"
  );
</code></pre>

<p>Which gives me a BIGINT equals to 1444923836822, which is the BIGINT for  2015-10-15 15:43:56.822, so this is OK.</p>

<p>But I need this BIGINT automatically translated in his TIMESTAMP equivalent, during the HIVE mapping.</p>

<p>Thanks, in advance for your help.</p>

<p>Romain.</p>