Search in sources :

Example 1 with IndexPredicateAnalyzer

use of org.apache.phoenix.hive.ql.index.IndexPredicateAnalyzer in project phoenix by apache.

the class PhoenixPredicateDecomposer method decomposePredicate.

public DecomposedPredicate decomposePredicate(ExprNodeDesc predicate) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("predicate - " + predicate.toString());
    }
    IndexPredicateAnalyzer analyzer = PredicateAnalyzerFactory.createPredicateAnalyzer(columnNameList, getFieldValidator());
    DecomposedPredicate decomposed = new DecomposedPredicate();
    List<IndexSearchCondition> conditions = new ArrayList<IndexSearchCondition>();
    decomposed.residualPredicate = (ExprNodeGenericFuncDesc) analyzer.analyzePredicate(predicate, conditions);
    if (!conditions.isEmpty()) {
        decomposed.pushedPredicate = analyzer.translateSearchConditions(conditions);
        try {
            searchConditionList = conditions;
            calledPPD = true;
        } catch (Exception e) {
            LOG.warn("Failed to decompose predicates", e);
            return null;
        }
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("decomposed predicate - residualPredicate: " + decomposed.residualPredicate + ", pushedPredicate: " + decomposed.pushedPredicate);
    }
    return decomposed;
}
Also used : DecomposedPredicate(org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate) IndexSearchCondition(org.apache.phoenix.hive.ql.index.IndexSearchCondition) ArrayList(java.util.ArrayList) IndexPredicateAnalyzer(org.apache.phoenix.hive.ql.index.IndexPredicateAnalyzer)

Aggregations

ArrayList (java.util.ArrayList)1 DecomposedPredicate (org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate)1 IndexPredicateAnalyzer (org.apache.phoenix.hive.ql.index.IndexPredicateAnalyzer)1 IndexSearchCondition (org.apache.phoenix.hive.ql.index.IndexSearchCondition)1