将值放在 Hbase 中同一系列的多个列中

pag*_*off 1 hadoop hbase

我正在寻找一个 Hbase put 命令,该命令可以将值插入到 Hbase 表中相同行键的同一列族中的多个列中。假设我有一个名为“employee”的 hbase 表,其中包含 1 个列族“data”

我正在应用以下命令,但它会引发错误。

PUT 'employee' 'data:column1', 'column1_val', 'data:column2', 'column_val2'
ERROR: no method 'add' for arguments (org.jruby.java.proxies.ArrayJavaProxy,org.jruby.RubyNil,org.jruby.RubyString,org.jruby.java.proxies.ArrayJavaProxy) on Java::OrgApacheHadoopHbaseClient::Put available overloads:
Run Code Online (Sandbox Code Playgroud)

但是,如果我为每个列值插入尝试单独的 put 命令,它工作正常。

PUT 'employee' 'data:column1', 'column1_val'
PUT 'employee' 'data:column2', 'column2_val'
Run Code Online (Sandbox Code Playgroud)

有没有办法在单个 put 命令中将值插入属于同一列族的多个列?

Ada*_*ker 6

HBase shell 不支持一个语句中的多列

hbase(main):002:0> help "put"
Put a cell 'value' at specified table/row/column and optionally
timestamp coordinates.  To put a cell value into table 'ns1:t1' or 't1'
at row 'r1' under column 'c1' marked with the time 'ts1', do:

  hbase> put 'ns1:t1', 'r1', 'c1', 'value'
  hbase> put 't1', 'r1', 'c1', 'value'
  hbase> put 't1', 'r1', 'c1', 'value', ts1
  hbase> put 't1', 'r1', 'c1', 'value', {ATTRIBUTES=>{'mykey'=>'myvalue'}}
  hbase> put 't1', 'r1', 'c1', 'value', ts1, {ATTRIBUTES=>{'mykey'=>'myvalue'}}
  hbase> put 't1', 'r1', 'c1', 'value', ts1, {VISIBILITY=>'PRIVATE|SECRET'}

The same commands also can be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding command would be:

  hbase> t.put 'r1', 'c1', 'value', ts1, {ATTRIBUTES=>{'mykey'=>'myvalue'}}
Run Code Online (Sandbox Code Playgroud)

不过,您可以创建多个具有相同时间戳的看跌期权,这很好。