0
votes

Sample Table

hbase(main):026:0> scan 'datatable'

ROW COLUMN+CELL

key1 column=cf1:col1, timestamp=1465135446446, value=value1

key1 column=cf1:col2, timestamp=1465135452934, value=value1

key2 column=cf2:col1, timestamp=1465135471613, value=value2

key2 column=cf2:col2, timestamp=1465135481068, value=value2

key3 column=cf1:col1, timestamp=1465137223212, value=value3

key3 column=cf2:col2, timestamp=1465137232291, value=value3

3 row(s) in 0.0300 seconds

Query

Filter the rows where any one of the condition below,

Row key is "key1", Where Column is {cf1:col1}

OR

Column is {cf2:col2}

Expected Output

ROW COLUMN+CELL

key1 column=cf1:col1, timestamp=1465135446446, value=value1

key2 column=cf2:col2, timestamp=1465135481068, value=value2

key3 column=cf2:col2, timestamp=1465137232291, value=value3

1

1 Answers

1
votes

Base64 Equivalent

cf1 => Y2Yx

col1 => Y29sMQ==

key1 => a2V5MQ==

cf2=> Y2Yy

col2 => Y29sMg==

OPERATORS(op) : LESS, LESS_OR_EQUAL, EQUAL, NOT_EQUAL, GREATER_OR_EQUAL, GREATER, NO_OP;

FILTER LIST (op) : MUST_PASS_ALL, MUST_PASS_ONE

{
    "type": "FilterList",
    "op": "MUST_PASS_ONE",
    "filters": [{
        "type": "FilterList",
        "op": "MUST_PASS_ALL",
        "filters": [{
            "type": "FamilyFilter",
            "op": "EQUAL",
            "comparator": {
                "type": "BinaryComparator",
                "value": "Y2Yx"
            }
        }, {
            "type": "QualifierFilter",
            "op": "EQUAL",
            "comparator": {
                "type": "BinaryComparator",
                "value": "Y29sMQ =="
            }
        }, {
            "type": "RowFilter",
            "op": "EQUAL",
            "comparator": {
                "type": "BinaryComparator",
                "value": "a2V5MQ=="
            }
        }]
    }, {
        "type": "FilterList",
        "op": "MUST_PASS_ALL",
        "filters": [{
            "type": "FamilyFilter",
            "op": "EQUAL",
            "comparator": {
                "type": "BinaryComparator",
                "value": "Y2Yy"
            }
        }, {
            "type": "QualifierFilter",
            "op": "EQUAL",
            "comparator": {
                "type": "BinaryComparator",
                "value": "Y29sMg=="
            }
        }]
    }]
}

$ curl -i -H "Content-Type: text/xml" -d @complex_filter.txt http://shva1.hwxblr.com:9292/datatable/scanner

HTTP/1.1 201 Created Location: http://shva1.hwxblr.com:9292/datatable/scanner/146513894809742c1664a

Sample Output

$ curl -i -H "Accept: application/json" http://shva1.hwxblr.com:9292/datatable/scanner/146513894809742c1664a

{"Row":[{"key":"a2V5MQ==","Cell":[{"column":"Y2YxOmNvbDE=","timestamp":1465135446446,"$":"dmFsdWUx"}]},{"key":"a2V5Mg==","Cell":[{"column":"Y2YyOmNvbDI=","timestamp":1465135481068,"$":"dmFsdWUy"}]},{"key":"a2V5Mw==","Cell":[{"column":"Y2YyOmNvbDI=","timestamp":1465137232291,"$":"dmFsdWUz"}]}]}