如何使用 Stargate REST API 在 HBase 中构建更复杂的过滤器层次结构?
Posted
技术标签:
【中文标题】如何使用 Stargate REST API 在 HBase 中构建更复杂的过滤器层次结构?【英文标题】:How to construct more complex filter hierarchy in HBase Using Stargate REST API? 【发布时间】:2016-10-05 06:57:24 【问题描述】:样本表
hbase(main):026:0> 扫描“数据表”
行列+单元格
key1 列=cf1:col1, 时间戳=1465135446446,值=值1
key1 列=cf1:col2,时间戳=1465135452934,值=value1
key2 列=cf2:col1,时间戳=1465135471613,值=value2
key2 列=cf2:col2,时间戳=1465135481068,值=value2
key3 列=cf1:col1,时间戳=1465137223212,值=value3
key3 列=cf2:col2,时间戳=1465137232291,值=value3
0.0300 秒内 3 行
查询
过滤满足以下任一条件的行,
行键是“key1”,列是cf1:col1
或
列是 cf2:col2
预期输出
行列+单元格
key1 列=cf1:col1,时间戳=1465135446446,值=value1
key2 列=cf2:col2,时间戳=1465135481068,值=value2
key3 列=cf2:col2,时间戳=1465137232291,值=value3
【问题讨论】:
【参考方案1】:Base64 等效项
cf1 => Y2Yx
col1 => Y29sMQ==
key1 => a2V5MQ==
cf2=> Y2Yy
col2 => Y29sMg==
“类型”:“过滤器列表”, "op": "MUST_PASS_ONE", “过滤器”:[ “类型”:“过滤器列表”, "op": "MUST_PASS_ALL", “过滤器”:[ "type": "FamilyFilter", "op": "相等", “比较器”: "type": "BinaryComparator", “值”:“Y2Yx” , "type": "QualifierFilter", "op": "相等", “比较器”: "type": "BinaryComparator", “值”:“Y29sMQ ==” , “类型”:“行过滤器”, "op": "相等", “比较器”: "type": "BinaryComparator", “价值”:“a2V5MQ== ] , “类型”:“过滤器列表”, "op": "MUST_PASS_ALL", “过滤器”:[ "type": "FamilyFilter", "op": "相等", “比较器”: "type": "BinaryComparator", “值”:“Y2Yy” , "type": "QualifierFilter", "op": "相等", “比较器”: "type": "BinaryComparator", “值”:“Y29sMg== ] ]OPERATORS(op):LESS、LESS_OR_EQUAL、EQUAL、NOT_EQUAL、GREATER_OR_EQUAL、GREATER、NO_OP;
过滤器列表(操作):MUST_PASS_ALL、MUST_PASS_ONE
$ curl -i -H "Content-Type: text/xml" -d @complex_filter.txt http://shva1.hwxblr.com:9292/datatable/scanner
HTTP/1.1 201 创建 地点:http://shva1.hwxblr.com:9292/datatable/scanner/146513894809742c1664a
样本输出
$ curl -i -H "接受:应用程序/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"]]
【讨论】:
以上是关于如何使用 Stargate REST API 在 HBase 中构建更复杂的过滤器层次结构?的主要内容,如果未能解决你的问题,请参考以下文章
markdown HBase Stargate REST API扫描程序筛选器示例
markdown HBase Stargate REST API扫描程序筛选器示例
Stargate REST API 是不是支持 LIMIT 子句?