Hbase shell scan 过滤器

1.查询是过滤使用的比较方式有以下几种。

  • The ComparatorType for the various comparators is as follows:
    • - BinaryComparator - binary
    • - BinaryPrefixComparator - binaryprefix
    • - RegexStringComparator - regexstring
    • - SubStringComparator - substring
  • Example ComparatorValues:
    • - binary:abc will match everything that is lexicographically greater than "abc"
    • - binaryprefix:abc will match everything whose first 3 characters are lexicographically equal to "abc"
    • - regexstring:ab*yz will match everything that doesn’t begin with "ab" and ends with "yz"
    • - substring:abc123 will match everything that begins with the substring "abc123"

2.命令示例代码:

scan "{namespace}:{tablename}",{FILTER=>"(RowFilter(=,'regexstring:{regstr}'))"}
  •     namespace: 命名空间。
  •     tablename:表名。
  •     regstr:匹配的字符。

    这里采用的是RowFilter,对RowKey进行滤,只查出RowKey包含regstr的数据。
3.过滤种类:

  • KeyOnlyFilter:This filter doesn’t take any arguments. It returns only the key component of each key-value.
  • FirstKeyOnlyFilter:This filter doesn’t take any arguments. It returns only the first key-value from each row.
  • PrefixFilter:This filter takes one argument – a prefix of a row key. It returns only those key-values present in a row that starts with the specified row prefix
  • ColumnPrefixFilter:This filter takes one argument – a column prefix. It returns only those key-values present in a column that starts with the specified column prefix. The column prefix must be of the form: “qualifier”.
  • MultipleColumnPrefixFilter:This filter takes a list of column prefixes. It returns key-values that are present in a column that starts with any of the specified column prefixes. Each of the column prefixes must be of the form: “qualifier”.
  • ColumnCountGetFilter:This filter takes one argument – a limit. It returns the first limit number of columns in the table.
  • PageFilter:This filter takes one argument – a page size. It returns page size number of rows from the table.
  • ColumnPaginationFilter:This filter takes two arguments – a limit and offset. It returns limit number of columns after offset number of columns. It does this for all the rows.
  • InclusiveStopFilter:This filter takes one argument – a row key on which to stop scanning. It returns all key-values present in rows up to and including the specified row.
  • TimeStampsFilter:This filter takes a list of timestamps. It returns those key-values whose timestamps matches any of the specified timestamps.
  • RowFilter:This filter takes a compare operator and a comparator. It compares each row key with the comparator using the compare operator and if the comparison returns true, it returns all the key-values in that row.
  • FamilyFilter:This filter takes a compare operator and a comparator. It compares each column family name with the comparator using the compare operator and if the comparison returns true, it returns all the Cells in that column family.
  • QualifierFilter:This filter takes a compare operator and a comparator. It compares each qualifier name with the comparator using the compare operator and if the comparison returns true, it returns all the key-values in that column.
  • ValueFilter:This filter takes a compare operator and a comparator. It compares each value with the comparator using the compare operator and if the comparison returns true, it returns that key-value.
  • DependentColumnFilter:This filter takes two arguments – a family and a qualifier. It tries to locate this column in each row and returns all key-values in that row that have the same timestamp. If the row doesn’t contain the specified column – none of the key-values in that row will be returned.
  • SingleColumnValueFilter:This filter takes a column family, a qualifier, a compare operator and a comparator. If the specified column is not found – all the columns of that row will be emitted. If the column is found and the comparison with the comparator returns true, all the columns of the row will be emitted. If the condition fails, the row will not be emitted.
  • SingleColumnValueExcludeFilter:This filter takes the same arguments and behaves same as SingleColumnValueFilter – however, if the column is found and the condition passes, all the columns of the row will be emitted except for the tested column value.
  • ColumnRangeFilter:This filter is used for selecting only those keys with columns that are between minColumn and maxColumn. It also takes two boolean variables to indicate whether to include the minColumn and maxColumn or not.

参照地址:http://hbase.apache.org/book.html#_shell_tricks

猜你喜欢

转载自blog.csdn.net/u011489205/article/details/81582683
今日推荐