问题描述
我想在hbase中写一个65的值。我必须在hbase shell上运行以下命令:
放置'table','key','cf:qual ','A'
但有没有办法直接编写它:
$ b $ pre $
放置'table','key','cf:qual',65(尽管这是不允许的)
让我知道如果你明白这个问题,我会解释更多的。
更新:
到65我的意思是把'A'直接放在'A'的ascii值上。对我来说,真正的问题是我想把shell的值设置在128-255的范围内。
既然Hbase Shell是使用ruby实现的,你可以通过用十六进制格式表示字节值来插入字节值。
lockquote
例如,如果你想插入一个字节值255:
255的十六进制表示是FF。
在Hbase shell中,我们应该给它作为stringBinary,它是\ 0xFF。
\x是一个特殊的转义字符,所以\xFF表示字节0xFF。
so 放置'table','rowkey','cf:qual' ,\xFF
会插入字节255
重要说明:该值必须与in(双引号)不是'(单引号)。
有用的链接:
I want to write a value say 65 in hbase. I have to run the following command on hbase shell for that:
put 'table','key','cf:qual','A'
But is there a way to write it directly something like:
put 'table','key','cf:qual',65 (this is not allowed though)
Let me know if you understand the question else I will explain more.
Update:
By 65 I meant to put 'A' but directly the ascii value of 'A'. The real issue for me is I want to put values which fall in the range of 128-255 from the shell.
Since Hbase Shell is implemented using ruby you can insert byte values by representing them in hexadecimal format.
Important note: The value has to be with in " " (double quotes) not ' ' (single quotes).
Useful links:
How Does Ruby handle bytes/binary
Hexadecimal Digits (Hex-Codes) Cheatsheet
这篇关于Hbase shell - 如何写字节值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!