Logical operators, comparison operators and comparators

Filters can be combined together with logical operators.

Some filters take a combination of comparison operators and comparators. Following is the list of each.

Logical Operators

  • AND - the key-value must pass both the filters to be included in the results.
  • OR - the key-value must pass at least one of the filters to be included in the results.
  • SKIP - for a particular row, if any of the key-values do not pass the filter condition, the entire row is skipped.
  • WHILE - For a particular row, it continues to emit key-values until a key-value is reached that fails the filter condition.
  • Compound Filters - Using these operators, a hierarchy of filters can be created. For example:
    (Filter1 AND Filter2)OR(Filter3 AND Filter4)

Comparison Operators

  • LESS (<)
  • LESS_OR_EQUAL (<=)
  • EQUAL (=)
  • NOT_EQUAL (!=)
  • GREATER_OR_EQUAL (>=)
  • GREATER (>)
  • NO_OP (no operation)

Comparators

  • BinaryComparator - lexicographically compares against the specified byte array using the Bytes.compareTo(byte[], byte[]) method.
  • BinaryPrefixComparator - lexicographically compares against a specified byte array. It only compares up to the length of this byte array.
  • RegexStringComparator - compares against the specified byte array using the given regular expression. Only EQUAL and NOT_EQUAL comparisons are valid with this comparator.
  • SubStringComparator - tests whether or not the given substring appears in a specified byte array. The comparison is case insensitive. Only EQUAL and NOT_EQUAL comparisons are valid with this comparator.

Examples

Example1: >, 'binary:abc' will match everything that is lexicographically greater than "abc"
   Example2: =, 'binaryprefix:abc' will match everything whose first 3 characters are lexicographically equal to "abc"
   Example3: !=, 'regexstring:ab*yz' will match everything that doesn't begin with "ab" and ends with "yz"
   Example4: =, 'substring:abc123' will match everything that begins with the substring "abc123"