[
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:02 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 key which is inserted first would overwrite the previous one.
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}
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 key which is inserted first would overwrite the previous one.
For example:
{code:java}
hbase(main):024:0> put 't1', 'row2', {'family1:column1'=>'a value1',
'family1:column1'=>'another value1', 'family2'=>'foobar1'}
Took 0.0020 seconds
hbase(main):025:0> scan 't1'
ROW COLUMN+CELL
row1 column=family1:column1,
timestamp=1522249091760, value=a value1
row1 column=family2:, timestamp=1522249091760,
value=foobar1
row1 column=family2:column2,
timestamp=1522249091760, value=another value1
row2 column=family1:column1,
timestamp=1522249109960, value=another value1
row2 column=family2:, timestamp=1522249109960,
value=foobar1
2 row(s)
Took 0.0068 seconds
hbase(main):026:0> put 't1', 'row2', {'family2:column2'=>'a value1',
'family2:column2'=>'another value1', 'family2'=>'foobar1'}
Took 0.0042 seconds
hbase(main):027:0> scan 't1'
ROW COLUMN+CELL
row1 column=family1:column1,
timestamp=1522249091760, value=a value1
row1 column=family2:, timestamp=1522249091760,
value=foobar1
row1 column=family2:column2,
timestamp=1522249091760, value=another value1
row2 column=family1:column1,
timestamp=1522249109960, value=another value1
row2 column=family2:, timestamp=1522249130804,
value=foobar1
row2 column=family2:column2,
timestamp=1522249130804, value=another value1
2 row(s)
Took 0.0051 seconds
hbase(main):028: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)