【问题标题】:Using multiple column filters with HappyBase在 HappyBase 中使用多列过滤器
【发布时间】:2013-08-02 12:22:51
【问题描述】:

我使用 HappyBase 作为 Python Thrift 客户端来连接 HBase。

我正在扫描表格,需要对多列使用过滤器。如何在 HappyBase 中实现这一点? Java 提供了一个使用 Filterlist 的选项。

【问题讨论】:

    标签: python hbase multiple-columns


    【解决方案1】:

    正如 github 页面上所指定的,Happybase 正在使用 Thrift。您应该使用与 thrift 相同的语法。

    在你的扫描功能上,你可以指定一个过滤字符串:

    SingleColumnValueFilter('', ', , '')

    例如,如果您需要扫描具有 blah:blouh = batman 列的所有行:

    hbase_table.scan(filter="SingleColumnValueFilter ('blah','blouh',=,'regexstring:^batman$')")
    

    您可以使用 AND 或 OR 放置多个过滤器,只需记住用括号括住所有内容。

    节俭文档:http://hbase.apache.org/book/thrift.html

    在字符串上创建过滤器时要小心,您必须使用特定的比较器(例如我的示例中的 regexstring)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-11
      • 2018-07-08
      • 2017-05-07
      • 2021-09-05
      • 2012-06-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多