Hello,

My HBase (MapR-DB to be exact) application is saving values as numerical
data types as follow:


====
    int intValue = 10;
    long longValue = 22l;
    double doubleValue = 123.123;
    float floatValue = 99.99f;
    BigDecimal bigDecimal = new BigDecimal(1111);


    put.addColumn( Bytes.toBytes("default") , Bytes.toBytes("int"),
Bytes.toBytes( intValue )  );
    put.addColumn( Bytes.toBytes("default") , Bytes.toBytes("long"),
Bytes.toBytes( longValue )  );
    put.addColumn( Bytes.toBytes("default") , Bytes.toBytes("double"),
Bytes.toBytes( doubleValue )  );
    put.addColumn( Bytes.toBytes("default") , Bytes.toBytes("float"),
Bytes.toBytes( floatValue )  );
    put.addColumn( Bytes.toBytes("default") , Bytes.toBytes("bigDecimal"),
Bytes.toBytes( bigDecimal )  );
====


I am trying to use the convert_from drill function to get the values out of
my database, but it does not work the way I was expecting...

select
 convert_from(t.`default`.`int` , 'INT') ,
 convert_from(t.`default`.`double`, 'DOUBLE' ) ,
 convert_from(t.`default`.`float`, 'FLOAT')
from dfs.`demos/simple_table` t
+------------+------------------------+---------------+
|   EXPR$0   |         EXPR$1         |    EXPR$2     |
+------------+------------------------+---------------+
| 167772160  | 2.79722325089736E-167  | -5.782555E20  |
+------------+------------------------+---------------+


1- What is the proper way to query HBase/MapR-DB to get the proper value?

2- Can I use such datatypes, or I need to store everything as String?

Regards
Tug

Reply via email to