@Override public Object clone() { FilterDesc filterDesc = new FilterDesc(getPredicate().clone(), getIsSamplingPred()); if (getIsSamplingPred()) { filterDesc.setSampleDescr(getSampleDescr()); } filterDesc.setSortedFilter(isSortedFilter()); return filterDesc; }
@Override public Object clone() { FilterDesc filterDesc = new FilterDesc(getPredicate().clone(), getIsSamplingPred()); if (getIsSamplingPred()) { filterDesc.setSampleDescr(getSampleDescr()); } filterDesc.setSortedFilter(isSortedFilter()); return filterDesc; }
@Override public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { FilterOperator cFIL = (FilterOperator) nd; FilterOperator pFIL = (FilterOperator) stack.get(stack.size() - 2); // Sampling predicates can be merged with predicates from children because PPD/PPR is // already applied. But to clarify the intention of sampling, just skips merging. if (pFIL.getConf().getIsSamplingPred()) { return null; } List<ExprNodeDesc> splits = new ArrayList<ExprNodeDesc>(); ExprNodeDescUtils.split(cFIL.getConf().getPredicate(), splits); ExprNodeDescUtils.split(pFIL.getConf().getPredicate(), splits); pFIL.getConf().setPredicate(ExprNodeDescUtils.mergePredicates(splits)); // if any of filter is sorted filter, it's sorted filter boolean sortedFilter = pFIL.getConf().isSortedFilter() || cFIL.getConf().isSortedFilter(); pFIL.getConf().setSortedFilter(sortedFilter); pFIL.removeChildAndAdoptItsChildren(cFIL); cFIL.setParentOperators(null); cFIL.setChildOperators(null); cFIL = null; return null; } }
@Override public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { FilterOperator cFIL = (FilterOperator) nd; FilterOperator pFIL = (FilterOperator) stack.get(stack.size() - 2); // Sampling predicates can be merged with predicates from children because PPD/PPR is // already applied. But to clarify the intention of sampling, just skips merging. if (pFIL.getConf().getIsSamplingPred()) { return null; } List<ExprNodeDesc> splits = new ArrayList<ExprNodeDesc>(); ExprNodeDescUtils.split(cFIL.getConf().getPredicate(), splits); ExprNodeDescUtils.split(pFIL.getConf().getPredicate(), splits); pFIL.getConf().setPredicate(ExprNodeDescUtils.mergePredicates(splits)); // if any of filter is sorted filter, it's sorted filter boolean sortedFilter = pFIL.getConf().isSortedFilter() || cFIL.getConf().isSortedFilter(); pFIL.getConf().setSortedFilter(sortedFilter); pFIL.removeChildAndAdoptItsChildren(cFIL); cFIL.setParentOperators(null); cFIL.setChildOperators(null); cFIL = null; return null; } }
/** * Does a depth first search on the operator tree looking for a filter operator whose predicate * has one child which is a column which is not in the partition * @param operators * @return whether or not it has found its target */ private boolean findIndexColumnFilter( Collection<Operator<? extends OperatorDesc>> operators) { for (Operator<? extends OperatorDesc> op : operators) { if (op instanceof FilterOperator && ((FilterOperator)op).getConf().getPredicate().getChildren() != null) { // Is this the target if (findIndexColumnExprNodeDesc(((FilterOperator)op).getConf().getPredicate())) { ((FilterOperator)op).getConf().setSortedFilter(true); return true; } } // If the target has been found, no need to continue if (findIndexColumnFilter(op.getChildOperators())) { return true; } } return false; }
@Override public Object clone() { FilterDesc filterDesc = new FilterDesc(getPredicate().clone(), getIsSamplingPred()); if (getIsSamplingPred()) { filterDesc.setSampleDescr(getSampleDescr()); } filterDesc.setSortedFilter(isSortedFilter()); return filterDesc; } }
@Override public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { FilterOperator cFIL = (FilterOperator) nd; FilterOperator pFIL = (FilterOperator) stack.get(stack.size() - 2); // Sampling predicates can be merged with predicates from children because PPD/PPR is // already applied. But to clarify the intention of sampling, just skips merging. if (pFIL.getConf().getIsSamplingPred()) { return null; } List<ExprNodeDesc> splits = new ArrayList<ExprNodeDesc>(); ExprNodeDescUtils.split(cFIL.getConf().getPredicate(), splits); ExprNodeDescUtils.split(pFIL.getConf().getPredicate(), splits); pFIL.getConf().setPredicate(ExprNodeDescUtils.mergePredicates(splits)); // if any of filter is sorted filter, it's sorted filter boolean sortedFilter = pFIL.getConf().isSortedFilter() || cFIL.getConf().isSortedFilter(); pFIL.getConf().setSortedFilter(sortedFilter); pFIL.removeChildAndAdoptItsChildren(cFIL); cFIL.setParentOperators(null); cFIL.setChildOperators(null); cFIL = null; return null; } }
/** * Does a depth first search on the operator tree looking for a filter operator whose predicate * has one child which is a column which is not in the partition * @param operators * @return whether or not it has found its target */ private boolean findIndexColumnFilter( Collection<Operator<? extends OperatorDesc>> operators) { for (Operator<? extends OperatorDesc> op : operators) { if (op instanceof FilterOperator && ((FilterOperator)op).getConf().getPredicate().getChildren() != null) { // Is this the target if (findIndexColumnExprNodeDesc(((FilterOperator)op).getConf().getPredicate())) { ((FilterOperator)op).getConf().setSortedFilter(true); return true; } } // If the target has been found, no need to continue if (findIndexColumnFilter(op.getChildOperators())) { return true; } } return false; }