[ 
https://issues.apache.org/jira/browse/HBASE-18999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16206056#comment-16206056
 ] 

Sean Busbey commented on HBASE-18999:
-------------------------------------

{code}
hbase(main):002:0> create 't1', 'family1', 'family2'
hbase(main):006:0> put = 
org.apache.hadoop.hbase.client.Put.new("row1".to_java_bytes)
hbase(main):008:0> put.add_column("family1".to_java_bytes, 
"column1".to_java_bytes, "a value".to_java_bytes)
=> #<Java::OrgApacheHadoopHbaseClient::Put:0x648855fd>
hbase(main):009:0> put.add_column("family1".to_java_bytes, 
"column2".to_java_bytes, "another value".to_java_bytes)
=> #<Java::OrgApacheHadoopHbaseClient::Put:0x648855fd>
hbase(main):010:0> put.add_column("family2".to_java_bytes, nil, 
"foobar".to_java_bytes)
=> #<Java::OrgApacheHadoopHbaseClient::Put:0x648855fd>
hbase(main):012:0> get_table("t1").table.put(put)
0 row(s) in 0.0010 seconds

hbase(main):013:0> scan 't1'
ROW                                                  COLUMN+CELL                
                                                                                
                                                                                
                                                             
 row1                                                column=family1:column1, 
timestamp=1507844083361, value=a value                                          
                                                
 row1                                                column=family1:column2, 
timestamp=1507844083361, value=another value                                    
            
 row1                                                column=family2:, 
timestamp=1507844083361, value=foobar                                    
1 row(s) in 0.0720 seconds
{code}

I don't know if the example is a good starting point for an implementation. 
Seems it'd be much simpler to e.g. just have {{table.put}} take an array for 
the {{col => value}} part.

> Put in hbase shell cannot do multiple columns
> ---------------------------------------------
>
>                 Key: HBASE-18999
>                 URL: https://issues.apache.org/jira/browse/HBASE-18999
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>    Affects Versions: 1.0.0, 2.0.0
>            Reporter: Mike Drob
>
> A {{Put}} can carry multiple cells, but doing so in the shell is very 
> difficult to construct. We should make this easier.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to