当前位置: 首页>>代码示例>>Java>>正文


Java Mutable.setValue方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.mutable.Mutable.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Mutable.setValue方法的具体用法?Java Mutable.setValue怎么用?Java Mutable.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.mutable.Mutable的用法示例。


在下文中一共展示了Mutable.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSellMarketOrders

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
private void createSellMarketOrders(Order order, Mutable<BigDecimal> buyGrossAmount,
		Mutable<BigDecimal> buyNetAmount) {
	if (order.getSellDistribution() != null && !order.getSellDistribution().isEmpty()) {
		buyGrossAmount.setValue(BigDecimal.ZERO);
		buyNetAmount.setValue(BigDecimal.ZERO);
		switch (order.getProcessInfo().getSellStrategy()) {
		case SELL_BY_AMOUNT:
			break;
		case SELL_BY_UNITS:
			break;
		case SELL_BY_MATH_PROVISION_PERCENT:
			break;
		default:
			break;
		}
	}
	else {
		buyGrossAmount.setValue(order.getGrossAmount());
		buyNetAmount.setValue(order.getNetAmount());
	}
}
 
开发者ID:labcabrera,项目名称:lab-insurance,代码行数:22,代码来源:MarketOrderGeneratorProcessor.java

示例2: rewritePre

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
    if (op.getOperatorTag() != LogicalOperatorTag.PROJECT) {
        return false;
    }
    ProjectOperator pi = (ProjectOperator) op;
    Mutable<ILogicalOperator> opRef2 = pi.getInputs().get(0);

    HashSet<LogicalVariable> toPush = new HashSet<LogicalVariable>();
    toPush.addAll(pi.getVariables());

    Pair<Boolean, Boolean> p = pushThroughOp(toPush, opRef2, op, context);
    boolean smthWasPushed = p.first;
    if (p.second) { // the original projection is redundant
        opRef.setValue(op.getInputs().get(0).getValue());
        smthWasPushed = true;
    }

    return smthWasPushed;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:23,代码来源:PushProjectDownRule.java

示例3: rewritePost

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    ILogicalOperator op = opRef.getValue();
    if (op.getOperatorTag() != LogicalOperatorTag.INNERJOIN
            && op.getOperatorTag() != LogicalOperatorTag.LEFTOUTERJOIN) {
        return false;
    }
    AbstractBinaryJoinOperator joinOperator = (AbstractBinaryJoinOperator) op;
    ILogicalOperator left = joinOperator.getInputs().get(0).getValue();
    ILogicalOperator right = joinOperator.getInputs().get(1).getValue();

    if (!joinOperator.getCondition().getValue().equals(ConstantExpression.TRUE)) {
        return false;
    }
    if (emptyBranch(left)) {
        opRef.setValue(right);
        return true;
    }
    if (emptyBranch(right)) {
        opRef.setValue(left);
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:26,代码来源:RemoveCartesianProductWithEmptyBranchRule.java

示例4: shouldAddToEventTreeForNMode

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
protected boolean shouldAddToEventTreeForNMode(TreeNode<NodeValue> parentNode, Mutable<TreeNode<NodeValue>> newNodeHolder,
        Event event) {
    boolean result = false;

    if (handleNoneEventHappenedButShouldNot(parentNode, newNodeHolder.getValue(), event)) {
        return false;
    }

    // We need only one node marking NONE event that has not happened, so others are removed.
    parentNode.getChildren().subList(1, parentNode.getChildren().size()).clear();

    // Because an event hasn't happened, the value of the node will be set to null.
    TreeNode<NodeValue> emptyNode = parentNode.getChildren().get(0);
    if (emptyNode.getValue().getEvent() != null) {
        emptyNode.getValue().setEvent(null);
    }

    // Recursively build event tree because the event may match one of the following expected events for this rule.
    buildEventTree(emptyNode, event);

    // Add to event tree only when the event does match one of the following expected events.
    if (emptyNode.hasChildren()) {
        result = true;
    }

    // Change newNode in the holder for further processing.
    newNodeHolder.setValue(emptyNode);

    return result;
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:32,代码来源:OrderedRuleAdapterRuntime.java

示例5: convertAlgebricksExpression

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private boolean convertAlgebricksExpression(Mutable<ILogicalExpression> searchM, IFunctionInfo funcInfo,
        boolean isBoolean) {
    AbstractFunctionCallExpression searchFunction = (AbstractFunctionCallExpression) searchM.getValue();
    searchFunction.setFunctionInfo(funcInfo);

    if (isBoolean) {
        ScalarFunctionCallExpression functionCallExp = new ScalarFunctionCallExpression(
                BuiltinFunctions.FN_BOOLEAN_1, new MutableObject<ILogicalExpression>(searchM.getValue()));
        searchM.setValue(functionCallExp);
    }
    return true;
}
 
开发者ID:apache,项目名称:vxquery,代码行数:14,代码来源:ConvertFromAlgebricksExpressionsRule.java

示例6: insertOneToOneExchange

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
private final static void insertOneToOneExchange(Mutable<ILogicalOperator> i, IOptimizationContext context)
        throws AlgebricksException {
    ExchangeOperator e = new ExchangeOperator();
    e.setPhysicalOperator(new OneToOneExchangePOperator());
    ILogicalOperator inOp = i.getValue();

    e.getInputs().add(new MutableObject<ILogicalOperator>(inOp));
    i.setValue(e);
    // e.recomputeSchema();
    OperatorPropertiesUtil.computeSchemaAndPropertiesRecIfNull(e, context);
    ExecutionMode em = ((AbstractLogicalOperator) inOp).getExecutionMode();
    e.setExecutionMode(em);
    e.computeDeliveredPhysicalProperties(context);
    context.computeAndSetTypeEnvironmentForOperator(e);
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:16,代码来源:IsolateHyracksOperatorsRule.java

示例7: pushDownFunctions

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
private boolean pushDownFunctions(AbstractBinaryJoinOperator joinOp, int inputIndex,
        List<Mutable<ILogicalExpression>> funcExprs, IOptimizationContext context) throws AlgebricksException {
    ILogicalOperator joinInputOp = joinOp.getInputs().get(inputIndex).getValue();
    liveVars.clear();
    VariableUtilities.getLiveVariables(joinInputOp, liveVars);
    Iterator<Mutable<ILogicalExpression>> funcIter = funcExprs.iterator();
    List<LogicalVariable> assignVars = null;
    List<Mutable<ILogicalExpression>> assignExprs = null;
    while (funcIter.hasNext()) {
        Mutable<ILogicalExpression> funcExprRef = funcIter.next();
        ILogicalExpression funcExpr = funcExprRef.getValue();
        usedVars.clear();
        funcExpr.getUsedVariables(usedVars);
        // Check if we can push the function down this branch.
        if (liveVars.containsAll(usedVars)) {
            if (assignVars == null) {
                assignVars = new ArrayList<LogicalVariable>();
                assignExprs = new ArrayList<Mutable<ILogicalExpression>>();
            }
            // Replace the original expression with a variable reference expression.
            LogicalVariable replacementVar = context.newVar();
            assignVars.add(replacementVar);
            assignExprs.add(new MutableObject<ILogicalExpression>(funcExpr));
            funcExprRef.setValue(new VariableReferenceExpression(replacementVar));
            funcIter.remove();
        }
    }
    // Create new assign operator below the join if any functions can be pushed.
    if (assignVars != null) {
        AssignOperator newAssign = new AssignOperator(assignVars, assignExprs);
        newAssign.getInputs().add(new MutableObject<ILogicalOperator>(joinInputOp));
        newAssign.setExecutionMode(joinOp.getExecutionMode());
        joinOp.getInputs().get(inputIndex).setValue(newAssign);
        context.computeAndSetTypeEnvironmentForOperator(newAssign);
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:39,代码来源:PushFunctionsBelowJoin.java

示例8: rewritePost

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
    if (op.getOperatorTag() != LogicalOperatorTag.GROUP) {
        return false;
    }
    GroupByOperator groupOp = (GroupByOperator) op;
    List<LogicalVariable> groupVars = groupOp.getGbyVarList();
    if (groupVars.size() > 0) {
        return false;
    }
    List<ILogicalPlan> nestedPlans = groupOp.getNestedPlans();
    if (nestedPlans.size() > 1) {
        return false;
    }
    ILogicalPlan nestedPlan = nestedPlans.get(0);
    if (nestedPlan.getRoots().size() > 1) {
        return false;
    }
    Mutable<ILogicalOperator> topOpRef = nestedPlan.getRoots().get(0);
    ILogicalOperator topOp = nestedPlan.getRoots().get(0).getValue();
    Mutable<ILogicalOperator> nestedTupleSourceRef = getNestedTupleSourceReference(topOpRef);
    /**
     * connect nested top op into the plan
     */
    opRef.setValue(topOp);
    /**
     * connect child op into the plan
     */
    nestedTupleSourceRef.setValue(groupOp.getInputs().get(0).getValue());
    return true;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:34,代码来源:EliminateGroupByEmptyKeyRule.java

示例9: factorRedundantRhsVars

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
private boolean factorRedundantRhsVars(List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> veList,
        Mutable<ILogicalOperator> opRef, Map<LogicalVariable, LogicalVariable> varRhsToLhs,
        IOptimizationContext context) throws AlgebricksException {
    varRhsToLhs.clear();
    ListIterator<Pair<LogicalVariable, Mutable<ILogicalExpression>>> iter = veList.listIterator();
    boolean changed = false;
    while (iter.hasNext()) {
        Pair<LogicalVariable, Mutable<ILogicalExpression>> p = iter.next();
        if (p.second.getValue().getExpressionTag() != LogicalExpressionTag.VARIABLE) {
            continue;
        }
        LogicalVariable v = GroupByOperator.getDecorVariable(p);
        LogicalVariable lhs = varRhsToLhs.get(v);
        if (lhs != null) {
            if (p.first != null) {
                AssignOperator assign = new AssignOperator(p.first, new MutableObject<ILogicalExpression>(
                        new VariableReferenceExpression(lhs)));
                ILogicalOperator op = opRef.getValue();
                assign.getInputs().add(new MutableObject<ILogicalOperator>(op));
                opRef.setValue(assign);
                context.computeAndSetTypeEnvironmentForOperator(assign);
            }
            iter.remove();
            changed = true;
        } else {
            varRhsToLhs.put(v, p.first);
        }
    }
    return changed;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:31,代码来源:FactorRedundantGroupAndDecorVarsRule.java

示例10: transform

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean transform(Mutable<ILogicalExpression> exprRef) throws AlgebricksException {
    ILogicalExpression e = exprRef.getValue();
    switch (((AbstractLogicalExpression) e).getExpressionTag()) {
        case VARIABLE: {
            LogicalVariable var = ((VariableReferenceExpression) e).getVariableReference();
            // Restrict replacement to targetVar if it has been set.
            if (targetVar != null && var != targetVar) {
                return false;
            }

            // Make sure has not been excluded from inlining.
            if (context.shouldNotBeInlined(var)) {
                return false;
            }

            ILogicalExpression rhs = varAssignRhs.get(var);
            if (rhs == null) {
                // Variable was not produced by an assign.
                return false;
            }

            // Make sure used variables from rhs are live.
            if (liveVars.isEmpty()) {
                VariableUtilities.getLiveVariables(op, liveVars);
            }
            rhsUsedVars.clear();
            rhs.getUsedVariables(rhsUsedVars);
            for (LogicalVariable rhsUsedVar : rhsUsedVars) {
                if (!liveVars.contains(rhsUsedVar)) {
                    return false;
                }
            }

            // Replace variable reference with a clone of the rhs expr.
            exprRef.setValue(rhs.cloneExpression());
            return true;
        }
        case FUNCTION_CALL: {
            AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) e;
            boolean modified = false;
            for (Mutable<ILogicalExpression> arg : fce.getArguments()) {
                if (transform(arg)) {
                    modified = true;
                }
            }
            return modified;
        }
        default: {
            return false;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:54,代码来源:InlineVariablesRule.java

示例11: rewritePost

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    AbstractLogicalOperator op1 = (AbstractLogicalOperator) opRef.getValue();
    // Even the LIMIT operator is a map operator, we don't push LIMIT operator into a join
    // since a new LIMIT under a join can't generate the original result.
    if (!op1.isMap() || op1.getOperatorTag() == LogicalOperatorTag.LIMIT) {
        return false;
    }
    Mutable<ILogicalOperator> op2Ref = op1.getInputs().get(0);
    AbstractLogicalOperator op2 = (AbstractLogicalOperator) op2Ref.getValue();
    if (op2.getOperatorTag() != LogicalOperatorTag.INNERJOIN) {
        return false;
    }
    AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op2;
    if (!OperatorPropertiesUtil.isAlwaysTrueCond(join.getCondition().getValue())) {
        return false;
    }

    List<LogicalVariable> used = new ArrayList<LogicalVariable>();
    VariableUtilities.getUsedVariables(op1, used);

    Mutable<ILogicalOperator> b0Ref = op2.getInputs().get(0);
    ILogicalOperator b0 = b0Ref.getValue();
    List<LogicalVariable> b0Scm = new ArrayList<LogicalVariable>();
    VariableUtilities.getLiveVariables(b0, b0Scm);
    if (b0Scm.containsAll(used)) {
        // push operator on left branch
        op2Ref.setValue(b0);
        b0Ref.setValue(op1);
        opRef.setValue(op2);
        return true;
    } else {
        Mutable<ILogicalOperator> b1Ref = op2.getInputs().get(1);
        ILogicalOperator b1 = b1Ref.getValue();
        List<LogicalVariable> b1Scm = new ArrayList<LogicalVariable>();
        VariableUtilities.getLiveVariables(b1, b1Scm);
        if (b1Scm.containsAll(used)) {
            // push operator on right branch
            op2Ref.setValue(b1);
            b1Ref.setValue(op1);
            opRef.setValue(op2);
            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:49,代码来源:PushMapOperatorDownThroughProductRule.java

示例12: rewritePost

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    AbstractLogicalOperator op1 = (AbstractLogicalOperator) opRef.getValue();
    if (op1.getOperatorTag() != LogicalOperatorTag.UNNEST) {
        return false;
    }
    Mutable<ILogicalOperator> op2Ref = op1.getInputs().get(0);
    AbstractLogicalOperator op2 = (AbstractLogicalOperator) op2Ref.getValue();
    if (op2.getOperatorTag() != LogicalOperatorTag.INNERJOIN) {
        return false;
    }
    AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op2;
    if (join.getCondition().getValue() != ConstantExpression.TRUE) {
        return false;
    }

    List<LogicalVariable> used = new ArrayList<LogicalVariable>();
    VariableUtilities.getUsedVariables(op1, used);

    Mutable<ILogicalOperator> b0Ref = op2.getInputs().get(0);
    ILogicalOperator b0 = b0Ref.getValue();
    List<LogicalVariable> b0Scm = new ArrayList<LogicalVariable>();
    VariableUtilities.getLiveVariables(b0, b0Scm);
    if (b0Scm.containsAll(used)) {
        // push unnest on left branch
        op2Ref.setValue(b0);
        b0Ref.setValue(op1);
        opRef.setValue(op2);
        return true;
    } else {
        Mutable<ILogicalOperator> b1Ref = op2.getInputs().get(1);
        ILogicalOperator b1 = b1Ref.getValue();
        List<LogicalVariable> b1Scm = new ArrayList<LogicalVariable>();
        VariableUtilities.getLiveVariables(b1, b1Scm);
        if (b1Scm.containsAll(used)) {
            // push unnest on right branch
            op2Ref.setValue(b1);
            b1Ref.setValue(op1);
            opRef.setValue(op2);
            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:47,代码来源:PushUnnestDownThroughProductRule.java

示例13: assignCommonExpression

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
private boolean assignCommonExpression(ExprEquivalenceClass exprEqClass, ILogicalExpression expr)
        throws AlgebricksException {
    AbstractLogicalOperator firstOp = (AbstractLogicalOperator) exprEqClass.getFirstOperator();
    Mutable<ILogicalExpression> firstExprRef = exprEqClass.getFirstExpression();
    if (firstOp.getOperatorTag() == LogicalOperatorTag.INNERJOIN
            || firstOp.getOperatorTag() == LogicalOperatorTag.LEFTOUTERJOIN) {
        // Do not extract common expressions from within the same join operator.
        if (firstOp == op) {
            return false;
        }
        AbstractBinaryJoinOperator joinOp = (AbstractBinaryJoinOperator) firstOp;
        Mutable<ILogicalExpression> joinCond = joinOp.getCondition();
        ILogicalExpression enclosingExpr = getEnclosingExpression(joinCond, firstExprRef.getValue());
        if (enclosingExpr == null) {
            // No viable enclosing expression that we can pull out from the join.
            return false;
        }
        // Place a Select operator beneath op that contains the enclosing expression.
        SelectOperator selectOp = new SelectOperator(new MutableObject<ILogicalExpression>(enclosingExpr),
                false, null);
        selectOp.getInputs().add(new MutableObject<ILogicalOperator>(op.getInputs().get(0).getValue()));
        op.getInputs().get(0).setValue(selectOp);
        // Set firstOp to be the select below op, since we want to assign the common subexpr there.
        firstOp = selectOp;
    } else if (firstOp.getInputs().size() > 1) {
        // Bail for any non-join operator with multiple inputs.
        return false;
    }
    LogicalVariable newVar = context.newVar();
    AssignOperator newAssign = new AssignOperator(newVar,
            new MutableObject<ILogicalExpression>(firstExprRef.getValue().cloneExpression()));
    // Place assign below firstOp.
    newAssign.getInputs().add(new MutableObject<ILogicalOperator>(firstOp.getInputs().get(0).getValue()));
    newAssign.setExecutionMode(firstOp.getExecutionMode());
    firstOp.getInputs().get(0).setValue(newAssign);
    // Replace original expr with variable reference, and set var in expression equivalence class.
    firstExprRef.setValue(new VariableReferenceExpression(newVar));
    exprEqClass.setVariable(newVar);
    context.computeAndSetTypeEnvironmentForOperator(newAssign);
    context.computeAndSetTypeEnvironmentForOperator(firstOp);
    return true;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:43,代码来源:ExtractCommonExpressionsRule.java

示例14: rewritePost

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    // TODO Fix EliminateSubplanForSinglePathsRule to check for variables used after the subplan.
    // TODO Add back to the rewrite rule list once fixed.
    
    // Do not process empty or nested tuple source.
    AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
    if (op.getOperatorTag() == LogicalOperatorTag.EMPTYTUPLESOURCE
            || op.getOperatorTag() == LogicalOperatorTag.NESTEDTUPLESOURCE) {
        return false;
    }

    // Set cardinality in the context. Must update each time the rule is run.
    VXQueryOptimizationContext vxqueryContext = (VXQueryOptimizationContext) context;
    Cardinality cardinalityVariable = CardinalityRuleToolbox.getProducerCardinality(opRef.getValue(), vxqueryContext);
    
    // Track variables created
    
    // Track variables used

    if (op.getOperatorTag() == LogicalOperatorTag.SUBPLAN && cardinalityVariable == Cardinality.ONE) {
        SubplanOperator subplan = (SubplanOperator) op;

        AbstractLogicalOperator subplanOp = (AbstractLogicalOperator) subplan.getNestedPlans().get(0).getRoots()
                .get(0).getValue();
        if (subplanOp.getOperatorTag() != LogicalOperatorTag.AGGREGATE) {
            return false;
        }

        // Change plan to remove the subplan.
        opRef.setValue(subplanOp);

        // Make inline the arguments for the subplan.
        AbstractLogicalOperator subplanEnd = findLastSubplanOperator(subplanOp);
        subplanEnd.getInputs().get(0).setValue(subplan.getInputs().get(0).getValue());

    }

    // Now with the new operator, update the variable mappings.
    cardinalityVariable = CardinalityRuleToolbox.updateCardinalityVariable(op, cardinalityVariable, vxqueryContext);
    // Save propagated value.
    vxqueryContext.putCardinalityOperatorMap(opRef.getValue(), cardinalityVariable);

    return false;
}
 
开发者ID:apache,项目名称:vxquery,代码行数:47,代码来源:EliminateSubplanForSinglePathsRule.java

示例15: rewritePost

import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();

    if (op.getOperatorTag() != LogicalOperatorTag.INNERJOIN) {
        return false;
    }
    AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op;

    ILogicalExpression expr = join.getCondition().getValue();
    if (expr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
        return false;
    }
    AbstractFunctionCallExpression fexp = (AbstractFunctionCallExpression) expr;
    FunctionIdentifier fi = fexp.getFunctionIdentifier();
    if (!(fi.equals(AlgebricksBuiltinFunctions.AND) || fi.equals(AlgebricksBuiltinFunctions.EQ))) {
        return false;
    }
    boolean modified = false;
    List<Mutable<ILogicalExpression>> functionList = new ArrayList<Mutable<ILogicalExpression>>();
    List<Mutable<ILogicalExpression>> variableList = new ArrayList<Mutable<ILogicalExpression>>();
    functionList.clear();
    ExpressionToolbox.findAllFunctionExpressions(join.getCondition(), AlgebricksBuiltinFunctions.EQ, functionList);
    Collection<LogicalVariable> producedVariables = new ArrayList<LogicalVariable>();
    for (Mutable<ILogicalExpression> searchM : functionList) {
        ILogicalExpression search = searchM.getValue();
        if (search.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            continue;
        }
        AbstractFunctionCallExpression searchExp = (AbstractFunctionCallExpression) search;
        // Go through all argument for EQ.
        for (Mutable<ILogicalExpression> expressionM : searchExp.getArguments()) {
            // Push on to branch when possible.
            for (Mutable<ILogicalOperator> branch : join.getInputs()) {
                producedVariables.clear();
                getProducedVariablesInDescendantsAndSelf(branch.getValue(), producedVariables);
                variableList.clear();
                ExpressionToolbox.findVariableExpressions(expressionM, variableList);
                boolean found = true;
                for (Mutable<ILogicalExpression> searchVariableM : variableList) {
                    VariableReferenceExpression vre = (VariableReferenceExpression) searchVariableM.getValue();
                    if (!producedVariables.contains(vre.getVariableReference())) {
                        found = false;
                    }
                }
                if (found) {
                    // push down
                    LogicalVariable assignVariable = context.newVar();
                    AssignOperator aOp = new AssignOperator(assignVariable, new MutableObject<ILogicalExpression>(expressionM.getValue()));
                    aOp.getInputs().add(new MutableObject<ILogicalOperator>(branch.getValue()));
                    branch.setValue(aOp);
                    aOp.recomputeSchema();
                    
                    expressionM.setValue(new VariableReferenceExpression(assignVariable));
                    modified = true;
                }
            }
        }
    }
    return modified;
}
 
开发者ID:apache,项目名称:vxquery,代码行数:63,代码来源:PushFunctionsOntoEqJoinBranches.java


注:本文中的org.apache.commons.lang3.mutable.Mutable.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。