I would like to easily load data in my HBase table. I thought using the ImportTsv
tool would be ideal. With something like this :
hbase org.apache.hadoop.hbase.mapreduce.ImportTsv '-Dimporttsv.separator=;' -Dimporttsv.columns=HBASE_ROW_KEY,f:i tab import.tsv
I want values in the column "f:i" to be stored as bytes (hex) NOT as strings. Because direct consequence is that I am unable to query that column with filters needing to make integers comparisons.
1 - If I use put in the shell :
p = Put.new(Bytes.toBytes('r1'))
p.add(bytes('f'), Bytes.toBytes('i'), Bytes.toBytes(10));
tab.put(p)
I get :
r1 column=f:i, timestamp=1398519413393, value=\x00\x00\x00\x00\x00\x00\x00\x0A
2 - If I use the ImportTsv tool I get :
r1 column=f:i, timestamp=1398519413393, value=10
But in this case my scans with the following filter (as an example) won't work anymore :
f = SingleColumnValueFilter.new(
Bytes.toBytes('f'),
Bytes.toBytes('i'),
CompareFilter::CompareOp::LESS_OR_EQUAL,
BinaryComparator.new(Bytes.toBytes(70))
)
So basically, is there a simple way to fine tune ImportTsv tool so that it stores the numbers like in the first case ?
Thanks a lot for your help !