如何使用stargate restapi在hbase中构建更复杂的过滤器层次结构?

wh6knrhe  于 2021-06-09  发布在  Hbase
关注(0)|答案(1)|浏览(319)

样品表

hbase(主):026:0>扫描“数据表”
行-列+单元格
key1 column=cf1:col1,timestamp=146515446446,value=value1
key1 column=cf1:col2,timestamp=14651352934,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
0.0300秒内3行

查询

过滤以下任何一个条件所在的行,
行键是“key1”,其中列是{cf1:col1}

列为{cf2:col2}

预期产量

行-列+单元格
key1 column=cf1:col1,timestamp=146515446446,value=value1
key2 column=cf2:col2,timestamp=1465135481068,value=value2
key3 column=cf2:col2,timestamp=1465137232291,value=value3

jei2mxaa

jei2mxaa1#

base64等效 cf1 => Y2Yx col1 => Y29sMQ== key1 => a2V5MQ== cf2=> Y2Yy col2 => Y29sMg== 运算符(op):less,less_or_equal,equal,not_equal,greater_or_equal,greater,no_op;

筛选列表(op):必须通过所有筛选,必须通过一个筛选

{
    "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“内容类型:text/xml”-d@complex\u filter.txthttp://shva1.hwxblr.com:9292/数据表/扫描仪
http/1.1 201创建位置:http://shva1.hwxblr.com:9292/数据表/扫描仪/146513894809742c1664a

样本输出

$curl-i-h“接受:application/json”http://shva1.hwxblr.com:9292/数据表/扫描仪/146513894809742c1664a
{“row”:[{“key”:“a2v5mq==”,“cell”:[{“column”:“y2yxomnvbde=”,“timestamp”:146515446446,“$”:“dmfsdwux”}]},{“key”:“a2v5mg==”,“cell”:[{“column”:“y2yyomnvbdi=”,“timestamp”:146535481068,“$”:“dmfsdwuy”}]},{“key”:“a2v5mw==”,“cell”:[{“column”:“y2yyymnvbdi=”,“timestamp”:1465372322191,$”:“dmfsdwuz”}]}}

相关问题