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

Nihal Jain edited comment on HBASE-18999 at 3/28/18 3:10 PM:
-------------------------------------------------------------

Based on [ruby documentation|http://ruby-doc.org/core-2.2.2/Hash.html]
{quote}Hashes enumerate their values in the order that the corresponding keys 
were inserted.
{quote}
So, the last instance of a duplicate column would overwrite the value of all 
previous ones.

 For example:
{code:java}
hbase(main):028:0> truncate 't1'
Truncating 't1' table (it may take a while):
Disabling table...
Truncating table...
Took 1.1459 seconds                                                             
                                                               
hbase(main):029:0> put 't1', 'row1', {'family1:column1'=>'a value1', 
'family2:column2'=>'another value1', 'family2'=>'foobar1'}
Took 0.1121 seconds                                                             
                                                               
hbase(main):030:0> scan 't1'
ROW                                  COLUMN+CELL                                
                                                               
 row1                                column=family1:column1, 
timestamp=1522249292372, value=a value1                                         
  
 row1                                column=family2:, timestamp=1522249292372, 
value=foobar1                                                   
 row1                                column=family2:column2, 
timestamp=1522249292372, value=another value1                                   
  
1 row(s)
Took 0.0039 seconds                                                             
                                                               
hbase(main):031:0> put 't1', 'row2', {'family1:column1'=>'a value1', 
'family1:column1'=>'another value1', 'family2'=>'foobar1'}
Took 0.0025 seconds                                                             
                                                               
hbase(main):032:0> scan 't1'
ROW                                  COLUMN+CELL                                
                                                               
 row1                                column=family1:column1, 
timestamp=1522249292372, value=a value1                                         
  
 row1                                column=family2:, timestamp=1522249292372, 
value=foobar1                                                   
 row1                                column=family2:column2, 
timestamp=1522249292372, value=another value1                                   
  
 row2                                column=family1:column1, 
timestamp=1522249299552, value=another value1                                   
  
 row2                                column=family2:, timestamp=1522249299552, 
value=foobar1                                                   
2 row(s)
Took 0.0041 seconds                                                             
                                                               
hbase(main):033:0> put 't1', 'row3', {'family2:column2'=>'a value1', 
'family2:column2'=>'another value1', 'family2'=>'foobar1'}
Took 0.0056 seconds                                                             
                                                               
hbase(main):034:0> scan 't1'
ROW                                  COLUMN+CELL                                
                                                               
 row1                                column=family1:column1, 
timestamp=1522249292372, value=a value1                                         
  
 row1                                column=family2:, timestamp=1522249292372, 
value=foobar1                                                   
 row1                                column=family2:column2, 
timestamp=1522249292372, value=another value1                                   
  
 row2                                column=family1:column1, 
timestamp=1522249299552, value=another value1                                   
  
 row2                                column=family2:, timestamp=1522249299552, 
value=foobar1                                                   
 row3                                column=family2:, timestamp=1522249310746, 
value=foobar1                                                   
 row3                                column=family2:column2, 
timestamp=1522249310746, value=another value1                                   
  
3 row(s)
Took 0.0085 seconds                                                             
                                                               
hbase(main):035:0>

{code}
 

Basically for any ruby hash map:
{code:java}
hbase(main):035:0> hash_map = {'family2:column2'=>'a value1', 
'family2:column2'=>'another value1', 'family2'=>'foobar1'}
=> {"family2:column2"=>"another value1", "family2"=>"foobar1"}
hbase(main):036:0>
{code}
 

So, HBase won't even get a copy of the duplicate column. Right?


was (Author: nihaljain.cs):
Based on [ruby documentation|http://ruby-doc.org/core-2.2.2/Hash.html]
{quote}Hashes enumerate their values in the order that the corresponding keys 
were inserted.
{quote}
So, the last instance of a duplicate column would overwrite the value of all 
previous ones.

 For example:
{code:java}
hbase(main):028:0> truncate 't1'
Truncating 't1' table (it may take a while):
Disabling table...
Truncating table...
Took 1.1459 seconds                                                             
                                                               
hbase(main):029:0> put 't1', 'row1', {'family1:column1'=>'a value1', 
'family2:column2'=>'another value1', 'family2'=>'foobar1'}
Took 0.1121 seconds                                                             
                                                               
hbase(main):030:0> scan 't1'
ROW                                  COLUMN+CELL                                
                                                               
 row1                                column=family1:column1, 
timestamp=1522249292372, value=a value1                                         
  
 row1                                column=family2:, timestamp=1522249292372, 
value=foobar1                                                   
 row1                                column=family2:column2, 
timestamp=1522249292372, value=another value1                                   
  
1 row(s)
Took 0.0039 seconds                                                             
                                                               
hbase(main):031:0> put 't1', 'row2', {'family1:column1'=>'a value1', 
'family1:column1'=>'another value1', 'family2'=>'foobar1'}
Took 0.0025 seconds                                                             
                                                               
hbase(main):032:0> scan 't1'
ROW                                  COLUMN+CELL                                
                                                               
 row1                                column=family1:column1, 
timestamp=1522249292372, value=a value1                                         
  
 row1                                column=family2:, timestamp=1522249292372, 
value=foobar1                                                   
 row1                                column=family2:column2, 
timestamp=1522249292372, value=another value1                                   
  
 row2                                column=family1:column1, 
timestamp=1522249299552, value=another value1                                   
  
 row2                                column=family2:, timestamp=1522249299552, 
value=foobar1                                                   
2 row(s)
Took 0.0041 seconds                                                             
                                                               
hbase(main):033:0> put 't1', 'row3', {'family2:column2'=>'a value1', 
'family2:column2'=>'another value1', 'family2'=>'foobar1'}
Took 0.0056 seconds                                                             
                                                               
hbase(main):034:0> scan 't1'
ROW                                  COLUMN+CELL                                
                                                               
 row1                                column=family1:column1, 
timestamp=1522249292372, value=a value1                                         
  
 row1                                column=family2:, timestamp=1522249292372, 
value=foobar1                                                   
 row1                                column=family2:column2, 
timestamp=1522249292372, value=another value1                                   
  
 row2                                column=family1:column1, 
timestamp=1522249299552, value=another value1                                   
  
 row2                                column=family2:, timestamp=1522249299552, 
value=foobar1                                                   
 row3                                column=family2:, timestamp=1522249310746, 
value=foobar1                                                   
 row3                                column=family2:column2, 
timestamp=1522249310746, value=another value1                                   
  
3 row(s)
Took 0.0085 seconds                                                             
                                                               
hbase(main):035:0>

{code}

> 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
>            Assignee: Nihal Jain
>            Priority: Major
>
> 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
(v7.6.3#76005)

Reply via email to