Created 02-08-2016 07:58 PM
I have created a view to map to an existing HBase table as following:
create view "wanghai:obsweather"(pk VARCHAR primary key, "d"."stationid" VARCHAR, "d"."temp" Float, ...);
In Hbase shell, my query on a row/column yields the following:
hbase(main):004:0> get 'wanghai:obsweather', 'AP611_mesonet|2014-02-01 00:01:30', 'd:temp:toFloat' COLUMN CELL d:temp timestamp=1454132157194, value=274.261108398437 1 row(s) in 0.0210 seconds
In Phoenix sqlline.py, I got the following:
0: jdbc:phoenix:localhost:2181:/hbase-unsecur> select pk, "d"."stationid", "d"."temp" from "wanghai:obsweather" . . . . . . . . . . . . . . . . . . . . . . .> where pk='AP611_mesonet|2014-02-01 00:01:30'; 'PK','stationid','temp' 'AP611_mesonet|2014-02-01 00:01:30','AP611_mesonet','-0.015067715' 1 row selected (0.11 seconds)
Any idea for the same (row, cf:q), why I get "274.2611" from Hbase shell, but "-0.015067715" in Phoenix?
What is wrong?
Created 02-08-2016 08:01 PM
HBase and Phoenix encode floats and some other data types differently.
This is from https://phoenix.apache.org/
The other caveat is that the way the bytes were serialized in HBase must match the way the bytes are expected to be serialized by Phoenix. For VARCHAR,CHAR, and UNSIGNED_* types, Phoenix uses the HBase Bytes utility methods to perform serialization. The CHAR type expects only single-byte characters and the UNSIGNED types expect values greater than or equal to zero.
Our composite row keys are formed by simply concatenating the values together, with a zero byte character used as a separator after a variable length type. For more information on our type system, see the Data Type.
Created 02-09-2016 07:20 PM
Thank you very much Enis!
Created 02-09-2016 07:26 PM
No worries! Keep on HBase'ing.