@Override
  public HBaseScanRange getScanRange(List<IndexSearchCondition> searchConditions)
      throws Exception {
    Map<String, List<IndexSearchCondition>> fieldConds =
        new HashMap<String, List<IndexSearchCondition>>();
    for (IndexSearchCondition condition : searchConditions) {
      String fieldName = condition.getFields()[0];
      List<IndexSearchCondition> fieldCond = fieldConds.get(fieldName);
      if (fieldCond == null) {
        fieldConds.put(fieldName, fieldCond = new ArrayList<IndexSearchCondition>());
      }
      fieldCond.add(condition);
    }
    List<Filter> filters = new ArrayList<Filter>();
    HBaseScanRange range = new HBaseScanRange();

    StructTypeInfo type = (StructTypeInfo) keyMapping.columnType;
    for (String name : type.getAllStructFieldNames()) {
      List<IndexSearchCondition> fieldCond = fieldConds.get(name);
      if (fieldCond == null || fieldCond.size() > 2) {
        continue;
      }
      for (IndexSearchCondition condition : fieldCond) {
        if (condition.getConstantDesc().getValue() == null) {
          continue;
        }
        String comparisonOp = condition.getComparisonOp();
        String constantVal = String.valueOf(condition.getConstantDesc().getValue());

        byte[] valueAsBytes = toBinary(constantVal, FIXED_LENGTH, false, false);

        if (comparisonOp.endsWith("UDFOPEqualOrGreaterThan")) {
          filters.add(new RowFilter(CompareOp.GREATER_OR_EQUAL, new BinaryComparator(valueAsBytes)));
        } else if (comparisonOp.endsWith("UDFOPGreaterThan")) {
          filters.add(new RowFilter(CompareOp.GREATER, new BinaryComparator(valueAsBytes)));
        } else if (comparisonOp.endsWith("UDFOPEqualOrLessThan")) {
          filters.add(new RowFilter(CompareOp.LESS_OR_EQUAL, new BinaryComparator(valueAsBytes)));
        } else if (comparisonOp.endsWith("UDFOPLessThan")) {
          filters.add(new RowFilter(CompareOp.LESS, new BinaryComparator(valueAsBytes)));
        } else {
          throw new IOException(comparisonOp + " is not a supported comparison operator");
        }
      }
    }
    if (!filters.isEmpty()) {
      range.addFilter(new FilterList(Operator.MUST_PASS_ALL, filters));
    }
    return range;
  }
Simple extension of {@link SampleHBaseKeyFactory2} with exception of using filters instead of start
and stop keys
hbase-handler/src/test/org/apache/hadoop/hive/hbase/SampleHBaseKeyFactory3.java