2011-12-28 25 views
0

我正在使用HBase cdh3u2。在HBase的壳我输入HBase Shell数据类型转换

 
put 'mytable', '2342', 'cf:c1', '67' (67 with quotes) 
and 
put 'mytable', '2341', 'cf:c1', 23 (23 without quotes) 
and 
put 'mytable', '2340', 'cf:c1', Bytes.toBytes(10) 

,并使用Java API的我已经把一些值的同桌,

put.add(columnFamily,coulumnName,Bytes.toBytes(123)); 

和HBase的壳我做了扫描。 除前两项外,所有数据都以不同格式存储。我无法猜测他们使用哪种方法转换为字节(Byets.toBytes())

通过询问,HBase的外壳采用了其中Bytes.toByte()方法

回答

1

HBase的外壳使该值作为字符串,最后两个选项(Bytes.toBytes()在外壳和java)把长值入列,不是字符串表示

+0

雅,但我在HBase获得不同的值到最后两种类型... – Nageswaran 2011-12-28 13:32:25