phoenix5-hive/src/main/java/org/apache/phoenix/hive/ppd/PhoenixPredicateDecomposer.java [36:93]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class PhoenixPredicateDecomposer {

    private static final Logger LOG = LoggerFactory.getLogger(PhoenixPredicateDecomposer.class);

    private List<String> columnNameList;
    private boolean calledPPD;

    private List<PhoenixSearchCondition> searchConditionList;

    public static PhoenixPredicateDecomposer create(List<String> columnNameList) {
        return new PhoenixPredicateDecomposer(columnNameList);
    }

    private PhoenixPredicateDecomposer(List<String> columnNameList) {
        this.columnNameList = columnNameList;
    }

    public DecomposedPredicate decomposePredicate(ExprNodeDesc predicate) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("predicate - " + predicate.toString());
        }

        PhoenixPredicateAnalyzer analyzer = PredicateAnalyzerFactory.createPredicateAnalyzer
                (columnNameList, getFieldValidator());
        DecomposedPredicate decomposed = new DecomposedPredicate();

        List<PhoenixSearchCondition> conditions = new ArrayList<PhoenixSearchCondition>();
        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;
    }

    public List<PhoenixSearchCondition> getSearchConditionList() {
        return searchConditionList;
    }

    public boolean isCalledPPD() {
        return calledPPD;
    }

    protected PhoenixPredicateAnalyzer.FieldValidator getFieldValidator() {
        return null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



phoenix5-hive4/src/main/java/org/apache/phoenix/hive/ppd/PhoenixPredicateDecomposer.java [36:93]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class PhoenixPredicateDecomposer {

    private static final Logger LOG = LoggerFactory.getLogger(PhoenixPredicateDecomposer.class);

    private List<String> columnNameList;
    private boolean calledPPD;

    private List<PhoenixSearchCondition> searchConditionList;

    public static PhoenixPredicateDecomposer create(List<String> columnNameList) {
        return new PhoenixPredicateDecomposer(columnNameList);
    }

    private PhoenixPredicateDecomposer(List<String> columnNameList) {
        this.columnNameList = columnNameList;
    }

    public DecomposedPredicate decomposePredicate(ExprNodeDesc predicate) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("predicate - " + predicate.toString());
        }

        PhoenixPredicateAnalyzer analyzer = PredicateAnalyzerFactory.createPredicateAnalyzer
                (columnNameList, getFieldValidator());
        DecomposedPredicate decomposed = new DecomposedPredicate();

        List<PhoenixSearchCondition> conditions = new ArrayList<PhoenixSearchCondition>();
        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;
    }

    public List<PhoenixSearchCondition> getSearchConditionList() {
        return searchConditionList;
    }

    public boolean isCalledPPD() {
        return calledPPD;
    }

    protected PhoenixPredicateAnalyzer.FieldValidator getFieldValidator() {
        return null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



