Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Combine few hbase shell commands

avatar
New Member

Hey,

I have a hbase table with 4 columns. I want to search for a string in column1 and get the value of column2 from every row, where I get a match. I works with these two codelines

scan 'table', { COLUMNS => 'column1', FILTER => "ValueFilter(=, 'substring:value')"}

Then foreach row: get 'table', $row, {COLUMNS => 'column2'}

How can I get the result (e.g. 'value1, value2, value3') by executing only one command?

best regards

J.H.

1 ACCEPTED SOLUTION

avatar
Master Collaborator

You can use SingleColumnValueFilter on 'column1'

Meanwhile, specify all the columns you want to retrieve using COLUMNS.

View solution in original post

3 REPLIES 3

avatar
Master Collaborator

You can use SingleColumnValueFilter on 'column1'

Meanwhile, specify all the columns you want to retrieve using COLUMNS.

avatar
New Member

@Ted Yu

Thank you for the help. Maybe you can give me an example how to use it, because I get only errors and the examples which I found are not for the shell.

avatar
Master Collaborator

Please take a look at hbase-shell//src/test/ruby/hbase/table_test.rb for sample syntax where x is column family:

@test_table._scan_internal(FILTER => "SingleColumnValueFilter('x', 'a', >=, 'binary:\x82', true, true)", COLUMNS => 'x:a, x:b'