public static IndexPredicateAnalyzer createAnalyzer(boolean equalOnly) { IndexPredicateAnalyzer analyzer = new IndexPredicateAnalyzer(); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"); if (equalOnly) { return analyzer; } analyzer.addComparisonOp( "org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrGreaterThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan"); return analyzer; }
/** * Instantiates a new predicate analyzer suitable for determining how to push a filter down into * the HBase scan, based on the rules for what kinds of pushdown we currently support. * * @param keyColumnName name of the Hive column mapped to the HBase row key * @return preconfigured predicate analyzer */ static IndexPredicateAnalyzer newIndexPredicateAnalyzer( String keyColumnName, String keyColType, boolean isKeyBinary) { IndexPredicateAnalyzer analyzer = new IndexPredicateAnalyzer(); // We can always do equality predicate. Just need to make sure we get appropriate // BA representation of constant of filter condition. analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"); // We can do other comparisons only if storage format in hbase is either binary // or we are dealing with string types since there lexographic ordering will suffice. if (isKeyBinary || (keyColType.equalsIgnoreCase("string"))) { analyzer.addComparisonOp( "org.apache.hadoop.hive.ql.udf.generic." + "GenericUDFOPEqualOrGreaterThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan"); } // and only on the key column analyzer.clearAllowedColumnNames(); analyzer.allowColumnName(keyColumnName); return analyzer; }