private ImmutableBitSet convert(long value, int length) {
      BitSet bits = new BitSet();
      for (int index = length - 1; index >= 0; index--) {
        if (value % 2 != 0) {
          bits.set(index);
        }
        value = value >>> 1;
      }
      // We flip the bits because Calcite considers that '1'
      // means that the column participates in the GroupBy
      // and '0' does not, as opposed to grouping_id.
      bits.flip(0, length);
      return ImmutableBitSet.FROM_BIT_SET.apply(bits);
    }
This method creates a HiveFilter containing a filter expression to enforce constraints.
Constraints to check: not null, check
The return value is the pair of Constraint HiveFilter and the corresponding RowResolver
or null if the target has no constraint defined or all of them are disabled.
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java