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'