Java Code Examples for org.apache.commons.lang3.mutable.Mutable#getValue()
The following examples show how to use
org.apache.commons.lang3.mutable.Mutable#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 6 votes |
public static Mutable<ILogicalExpression> findVariableExpression(Mutable<ILogicalExpression> mutableLe, LogicalVariable lv) { ILogicalExpression le = mutableLe.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.VARIABLE) { VariableReferenceExpression vre = (VariableReferenceExpression) le; if (vre.getVariableReference() == lv) { return mutableLe; } } else if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; for (Mutable<ILogicalExpression> argExp : afce.getArguments()) { Mutable<ILogicalExpression> resultLe = findVariableExpression(argExp, lv); if (resultLe != null) { return resultLe; } } } return null; }
Example 2
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 6 votes |
public static Mutable<ILogicalExpression> findLastFunctionExpression(Mutable<ILogicalExpression> mutableLe) { ILogicalExpression le = mutableLe.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.VARIABLE) { return null; } else if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; for (Mutable<ILogicalExpression> argExp : afce.getArguments()) { if (argExp.getValue().getExpressionTag() == LogicalExpressionTag.VARIABLE) { return mutableLe; } Mutable<ILogicalExpression> resultLe = findLastFunctionExpression(argExp); if (resultLe != null) { return resultLe; } } } return null; }
Example 3
Source File: OperatorToolbox.java From vxquery with Apache License 2.0 | 6 votes |
public static Mutable<ILogicalExpression> getExpressionOf(Mutable<ILogicalOperator> opRef, LogicalVariable lv) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); switch (op.getOperatorTag()) { case AGGREGATE: case ASSIGN: case RUNNINGAGGREGATE: AbstractAssignOperator aao = (AbstractAssignOperator) op; if (!aao.getVariables().contains(lv)) { return null; } return aao.getExpressions().get(aao.getVariables().indexOf(lv)); case UNNEST: case UNNEST_MAP: AbstractUnnestOperator ano = (AbstractUnnestOperator) op; return ano.getExpressionRef(); default: // TODO Not yet implemented. break; } return null; }
Example 4
Source File: AbstractCollectionRule.java From vxquery with Apache License 2.0 | 5 votes |
protected boolean setDataSourceScan(IDataSource<String> ids, Mutable<ILogicalOperator> opRef) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); UnnestOperator unnest = (UnnestOperator) op; Mutable<ILogicalOperator> opRef2 = unnest.getInputs().get(0); AbstractLogicalOperator op2 = (AbstractLogicalOperator) opRef2.getValue(); AssignOperator assign = (AssignOperator) op2; DataSourceScanOperator opNew = new DataSourceScanOperator(assign.getVariables(), ids); opNew.getInputs().addAll(assign.getInputs()); opRef2.setValue(opNew); return true; }
Example 5
Source File: ConvertAssignSortDistinctNodesToOperatorsRule.java From vxquery with Apache License 2.0 | 5 votes |
private Mutable<ILogicalOperator> getInputOperator(Mutable<ILogicalOperator> opRef) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); switch (op.getOperatorTag()) { case SUBPLAN: SubplanOperator subplan = (SubplanOperator) op; return getInputOperator(subplan.getNestedPlans().get(0).getRoots().get(0)); case NESTEDTUPLESOURCE: NestedTupleSourceOperator nts = (NestedTupleSourceOperator) op; return getInputOperator(nts.getDataSourceReference()); default: return opRef; } }
Example 6
Source File: AbstractCollectionRule.java From vxquery with Apache License 2.0 | 5 votes |
/** * Get the arguments for the collection and collection-with-tag. Return null for not a collection. * * @param opRef * Logical operator * @param functions * Functions identifiers * @return collection name */ protected String[] getFunctionalArguments(Mutable<ILogicalOperator> opRef, Set<FunctionIdentifier> functions) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); if (op.getOperatorTag() != LogicalOperatorTag.UNNEST) { return null; } UnnestOperator unnest = (UnnestOperator) op; // Check if assign is for fn:Collection. AbstractLogicalOperator op2 = (AbstractLogicalOperator) unnest.getInputs().get(0).getValue(); if (op2.getOperatorTag() != LogicalOperatorTag.ASSIGN) { return null; } AssignOperator assign = (AssignOperator) op2; // Check to see if the expression is a function and fn:Collection. ILogicalExpression logicalExpression = assign.getExpressions().get(0).getValue(); if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) { return null; } functionCall = (AbstractFunctionCallExpression) logicalExpression; if (!functions.contains(functionCall.getFunctionIdentifier())) { return null; } // Get arguments int size = functionCall.getArguments().size(); if (size > 0) { String[] args = new String[size]; for (int i = 0; i < size; i++) { args[i] = getArgument(functionCall, opRef, i); } return args; } return null; }
Example 7
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 5 votes |
public static Mutable<ILogicalExpression> findVariableExpression(Mutable<ILogicalExpression> mutableLe) { ILogicalExpression le = mutableLe.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.VARIABLE) { return mutableLe; } else if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; for (Mutable<ILogicalExpression> argExp : afce.getArguments()) { Mutable<ILogicalExpression> resultLe = findVariableExpression(argExp); if (resultLe != null) { return resultLe; } } } return null; }
Example 8
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 5 votes |
public static void findVariableExpressions(Mutable<ILogicalExpression> mutableLe, List<Mutable<ILogicalExpression>> finds) { ILogicalExpression le = mutableLe.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.VARIABLE) { finds.add(mutableLe); } else if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; for (Mutable<ILogicalExpression> argExp : afce.getArguments()) { findVariableExpressions(argExp, finds); } } }
Example 9
Source File: ExtractFunctionsFromJoinConditionRule.java From vxquery with Apache License 2.0 | 5 votes |
@Override public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); if (op.getOperatorTag() != LogicalOperatorTag.INNERJOIN && op.getOperatorTag() != LogicalOperatorTag.LEFTOUTERJOIN) { return false; } AbstractBinaryJoinOperator joinOp = (AbstractBinaryJoinOperator) op; ILogicalExpression expr = joinOp.getCondition().getValue(); return assignFunctionExpressions(joinOp, expr, context); }
Example 10
Source File: ConvertFromAlgebricksExpressionsRule.java From vxquery with Apache License 2.0 | 5 votes |
@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; }
Example 11
Source File: ConvertAssignToAggregateRule.java From vxquery with Apache License 2.0 | 5 votes |
private Mutable<ILogicalOperator> getInputOperator(Mutable<ILogicalOperator> opRef) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); switch (op.getOperatorTag()) { case SUBPLAN: SubplanOperator subplan = (SubplanOperator) op; return getInputOperator(subplan.getNestedPlans().get(0).getRoots().get(0)); case NESTEDTUPLESOURCE: NestedTupleSourceOperator nts = (NestedTupleSourceOperator) op; return getInputOperator(nts.getDataSourceReference()); default: return opRef; } }
Example 12
Source File: RemoveUnusedSortDistinctNodesRule.java From vxquery with Apache License 2.0 | 5 votes |
private int getOperatorSortDistinctNodesAscOrAtomicsArgumentVariableId(Mutable<ILogicalOperator> opRef) { // Check if assign is for sort-distinct-nodes-asc-or-atomics. AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); if (op.getOperatorTag() != LogicalOperatorTag.ASSIGN) { return 0; } AssignOperator assign = (AssignOperator) op; // Check to see if the expression is a function and // sort-distinct-nodes-asc-or-atomics. ILogicalExpression logicalExpression = (ILogicalExpression) assign.getExpressions().get(0).getValue(); if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) { return 0; } AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression; if (!functionCall.getFunctionIdentifier() .equals(BuiltinOperators.SORT_DISTINCT_NODES_ASC_OR_ATOMICS.getFunctionIdentifier())) { return 0; } // Find the variable id used as the parameter. ILogicalExpression logicalExpression2 = (ILogicalExpression) functionCall.getArguments().get(0).getValue(); if (logicalExpression2.getExpressionTag() != LogicalExpressionTag.VARIABLE) { return 0; } VariableReferenceExpression variableExpression = (VariableReferenceExpression) logicalExpression2; return variableExpression.getVariableReference().getId(); }
Example 13
Source File: PushValueIntoDatascanRule.java From vxquery with Apache License 2.0 | 5 votes |
@Override boolean updateDataSource(IVXQueryDataSource datasource, Mutable<ILogicalExpression> expression) { if (datasource.usingIndex()) { return false; } VXQueryCollectionDataSource ds = (VXQueryCollectionDataSource) datasource; boolean added = false; List<Mutable<ILogicalExpression>> finds = new ArrayList<Mutable<ILogicalExpression>>(); ILogicalExpression le = expression.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; if (afce.getFunctionIdentifier().equals(BuiltinFunctions.FN_ZERO_OR_ONE_1.getFunctionIdentifier())) { return false; } } ExpressionToolbox.findAllFunctionExpressions(expression, BuiltinOperators.VALUE.getFunctionIdentifier(), finds); for (int i = finds.size(); i > 0; --i) { Byte[] value = null; List<ILogicalExpression> values = ExpressionToolbox.getFullArguments(finds.get(i - 1)); if (values.size() > 1) { value = ExpressionToolbox.getConstantArgument(finds.get(i - 1), 1); ds.addValueSeq(value); added = true; } } return added; }
Example 14
Source File: SetVariableIdContextRule.java From vxquery with Apache License 2.0 | 5 votes |
@Override public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { if (context.checkIfInDontApplySet(this, opRef.getValue())) { return false; } int variableId = 0; // TODO Move the setVarCounter to the compiler after the translator has run. AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); switch (op.getOperatorTag()) { case ASSIGN: case AGGREGATE: AbstractAssignOperator assign = (AbstractAssignOperator) op; if (assign.getVariables().size() > 0) { variableId = assign.getVariables().get(0).getId(); } break; case UNNEST: UnnestOperator unnest = (UnnestOperator) op; variableId = unnest.getVariable().getId(); break; default: return false; } if (context.getVarCounter() <= variableId) { context.setVarCounter(variableId + 1); } context.addToDontApplySet(this, opRef.getValue()); return false; }
Example 15
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 5 votes |
public static List<ILogicalExpression> getFullArguments(Mutable<ILogicalExpression> searchM) { AbstractFunctionCallExpression searchFunction = (AbstractFunctionCallExpression) searchM.getValue(); ArrayList<ILogicalExpression> args = new ArrayList<ILogicalExpression>(); for (int i = 0; i < searchFunction.getArguments().size(); i++) { args.add(searchFunction.getArguments().get(i).getValue()); } return args; }
Example 16
Source File: PushIndexingIntoDatascanRule.java From vxquery with Apache License 2.0 | 5 votes |
@Override protected boolean processOperator(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { if (context.checkIfInDontApplySet(this, opRef.getValue())) { return false; } AbstractLogicalOperator op2 = null; if (dCtx == null) { VXQueryOptimizationContext vxqueryCtx = (VXQueryOptimizationContext) context; dCtx = ((VXQueryMetadataProvider) vxqueryCtx.getMetadataProvider()).getStaticContext(); } AbstractLogicalOperator op1 = (AbstractLogicalOperator) opRef.getValue(); if (op1.getOperatorTag() != LogicalOperatorTag.SELECT) { return false; } SelectOperator select = (SelectOperator) op1; op2 = (AbstractLogicalOperator) select.getInputs().get(0).getValue(); if (op2.getOperatorTag() != LogicalOperatorTag.DATASOURCESCAN) { return false; } DataSourceScanOperator datascan = (DataSourceScanOperator) op2; if (!usedVariables.contains(datascan.getVariables())) { Mutable<ILogicalExpression> expressionRef = select.getCondition(); if (!(updateDataSource((IVXQueryDataSource) datascan.getDataSource(), expressionRef))) { return false; } context.addToDontApplySet(this, opRef.getValue()); return true; } return false; }
Example 17
Source File: ConvertAssignToAggregateRule.java From vxquery with Apache License 2.0 | 4 votes |
/** * Find where an assign for a aggregate function is used before aggregate operator for a sequence. * Search pattern 1: assign [function-call: count(function-call: treat($$))] * Search pattern 2: $$ for aggregate [function-call: sequence()] */ @Override public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { IFunctionInfo aggregateInfo; AbstractFunctionCallExpression finalFunctionCall; Mutable<ILogicalOperator> nextOperatorRef; // Check if assign is for aggregate function. AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); if (op.getOperatorTag() != LogicalOperatorTag.ASSIGN) { return false; } AssignOperator assign = (AssignOperator) op; Mutable<ILogicalExpression> mutableLogicalExpression = assign.getExpressions().get(0); ILogicalExpression logicalExpression = mutableLogicalExpression.getValue(); if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) { return false; } AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression; // TODO get the function through the function definition aggregateInfo = getAggregateFunction(functionCall); if (aggregateInfo == null) { return false; } Mutable<ILogicalExpression> mutableVariableExpresion = ExpressionToolbox.findVariableExpression(mutableLogicalExpression); if (mutableVariableExpresion == null) { return false; } Mutable<ILogicalExpression> finalFunctionCallM = ExpressionToolbox .findLastFunctionExpression(mutableLogicalExpression); finalFunctionCall = (AbstractFunctionCallExpression) finalFunctionCallM.getValue(); // Build a subplan for replacing the sort distinct function with operators. // Nested tuple source. Mutable<ILogicalOperator> inputOperator = getInputOperator(assign.getInputs().get(0)); NestedTupleSourceOperator ntsOperator = new NestedTupleSourceOperator(inputOperator); nextOperatorRef = new MutableObject<ILogicalOperator>(ntsOperator); // Get variable that is being used for sort and distinct operators. VariableReferenceExpression inputVariableRef = (VariableReferenceExpression) mutableVariableExpresion.getValue(); LogicalVariable inputVariable = inputVariableRef.getVariableReference(); // Unnest. LogicalVariable unnestVariable = context.newVar(); UnnestOperator unnestOperator = getUnnestOperator(inputVariable, unnestVariable); unnestOperator.getInputs().add(nextOperatorRef); nextOperatorRef = new MutableObject<ILogicalOperator>(unnestOperator); // Aggregate. VariableReferenceExpression inputArg = new VariableReferenceExpression(unnestVariable); finalFunctionCall.getArguments().get(0).setValue(inputArg); Mutable<ILogicalExpression> aggregateArgs = functionCall.getArguments().get(0); LogicalVariable aggregateVariable = assign.getVariables().get(0); AggregateOperator aggregateOperator = getAggregateOperator(aggregateInfo, aggregateArgs, aggregateVariable); aggregateOperator.getInputs().add(nextOperatorRef); nextOperatorRef = new MutableObject<ILogicalOperator>(aggregateOperator); // Subplan. SubplanOperator subplanOperator = new SubplanOperator(); subplanOperator.getInputs().add(assign.getInputs().get(0)); subplanOperator.setRootOp(nextOperatorRef); assign.getInputs().clear(); opRef.setValue(subplanOperator); return true; }
Example 18
Source File: ReplaceSourceMapInDocExpression.java From vxquery with Apache License 2.0 | 4 votes |
protected boolean updateDocExpression(Mutable<ILogicalOperator> opRef, Mutable<ILogicalExpression> funcExpression, IOptimizationContext context) { VXQueryConstantValue constantValue = null; ConstantExpression constantExpression = null; ILogicalExpression logicalExpression = (ILogicalExpression) funcExpression.getValue(); if (logicalExpression.getExpressionTag() == LogicalExpressionTag.CONSTANT) { constantExpression = (ConstantExpression) logicalExpression; constantValue = (VXQueryConstantValue) constantExpression.getValue(); } else if (logicalExpression.getExpressionTag() == LogicalExpressionTag.VARIABLE) { VariableReferenceExpression varLogicalExpression = (VariableReferenceExpression) logicalExpression; Mutable<ILogicalOperator> lop = OperatorToolbox.findProducerOf(opRef, varLogicalExpression.getVariableReference()); ILogicalExpression variableLogicalExpression = (ILogicalExpression) OperatorToolbox.getExpressionOf(lop, varLogicalExpression.getVariableReference()).getValue(); if (variableLogicalExpression.getExpressionTag() != LogicalExpressionTag.CONSTANT) { return false; } constantExpression = (ConstantExpression) variableLogicalExpression; constantValue = (VXQueryConstantValue) constantExpression.getValue(); } else { return false; } if (constantValue.getType() != SequenceType.create(BuiltinTypeRegistry.XS_STRING, Quantifier.QUANT_ONE)) { return false; } tvp.set(constantValue.getValue(), 0, constantValue.getValue().length); tvp.getValue(stringp); if (tvp.getTag() != ValueTag.XS_STRING_TAG) { return false; } stringp.toString(toStr); docArg = toStr.toString(); VXQueryMetadataProvider mdp = (VXQueryMetadataProvider) context.getMetadataProvider(); if (mdp.getSourceFileMap() == null) { return false; } if (!mdp.getSourceFileMap().containsKey(docArg)) { return false; } File file = mdp.getSourceFileMap().get(docArg); StringValueBuilder svb = new StringValueBuilder(); try { abvs.reset(); dOut.write(ValueTag.XS_STRING_TAG); svb.write(file.getAbsolutePath(), dOut); } catch (IOException e) { throw new IllegalStateException(e); } VXQueryConstantValue vxqcv = new VXQueryConstantValue(SequenceType.create(BuiltinTypeRegistry.XS_STRING, Quantifier.QUANT_ONE), abvs.getByteArray()); constantExpression.setValue(vxqcv); return true; }
Example 19
Source File: PushAggregateIntoGroupbyRule.java From vxquery with Apache License 2.0 | 4 votes |
/** * @param expr * @param aggVars * @param gbyWithAgg * @param context * @return a pair whose first member is a boolean which is true iff * something was changed in the expression tree rooted at expr. The * second member is the result of transforming expr. * @throws AlgebricksException */ private Pair<Boolean, ILogicalExpression> extractAggFunctionsFromExpression(Mutable<ILogicalExpression> exprRef, Map<LogicalVariable, GroupByOperator> gbyWithAgg, Map<ILogicalExpression, ILogicalExpression> aggregateExprToVarExpr, IOptimizationContext context) throws AlgebricksException { ILogicalExpression expr = exprRef.getValue(); switch (expr.getExpressionTag()) { case FUNCTION_CALL: { AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) expr; Function functionInfo = (Function) fce.getFunctionInfo(); FunctionIdentifier fi = null; if (functionInfo.hasAggregateEvaluatorFactory()) { fi = functionInfo.getFunctionIdentifier(); } //FunctionIdentifier fi = functionInfo.getFunctionIdentifier(); if (fi != null) { ILogicalExpression a1 = fce.getArguments().get(0).getValue(); if (a1.getExpressionTag() == LogicalExpressionTag.VARIABLE) { LogicalVariable argVar = ((VariableReferenceExpression) a1).getVariableReference(); GroupByOperator gbyOp = gbyWithAgg.get(argVar); if (gbyOp != null) { if (!aggregateExprToVarExpr.containsKey(expr)) { LogicalVariable newVar = context.newVar(); AggregateFunctionCallExpression aggFun = new AggregateFunctionCallExpression( functionInfo, false, fce.getArguments()); rewriteGroupByAggregate(argVar, gbyOp, aggFun, newVar, context); ILogicalExpression newVarExpr = new VariableReferenceExpression(newVar); aggregateExprToVarExpr.put(expr, newVarExpr); return new Pair<Boolean, ILogicalExpression>(Boolean.TRUE, newVarExpr); } else { ILogicalExpression varExpr = aggregateExprToVarExpr.get(expr); return new Pair<Boolean, ILogicalExpression>(Boolean.TRUE, varExpr); } } } } boolean change = false; for (Mutable<ILogicalExpression> a : fce.getArguments()) { Pair<Boolean, ILogicalExpression> aggArg = extractAggFunctionsFromExpression(a, gbyWithAgg, aggregateExprToVarExpr, context); if (aggArg.first.booleanValue()) { a.setValue(aggArg.second); change = true; } } return new Pair<Boolean, ILogicalExpression>(change, fce); } case VARIABLE: case CONSTANT: { return new Pair<Boolean, ILogicalExpression>(Boolean.FALSE, expr); } default: { throw new IllegalArgumentException(); } } }
Example 20
Source File: ConsolidateUnnestsRule.java From vxquery with Apache License 2.0 | 4 votes |
protected boolean processOperator(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); if (op.getOperatorTag() != LogicalOperatorTag.UNNEST) { return false; } UnnestOperator unnest1 = (UnnestOperator) op; AbstractLogicalOperator op2 = (AbstractLogicalOperator) unnest1.getInputs().get(0).getValue(); if (op2.getOperatorTag() != LogicalOperatorTag.UNNEST) { return false; } UnnestOperator unnest2 = (UnnestOperator) op2; if (usedVariables.contains(unnest2.getVariable())) { return false; } // Check to see if the unnest2 expression has a scalar implementation. ILogicalExpression logicalExpression2 = (ILogicalExpression) unnest2.getExpressionRef().getValue(); if (logicalExpression2.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) { return false; } AbstractFunctionCallExpression functionCall2 = (AbstractFunctionCallExpression) logicalExpression2; Function functionInfo2 = (Function) functionCall2.getFunctionInfo(); if (!functionInfo2.hasScalarEvaluatorFactory()) { return false; } // Exception for specific path expressions. if (functionCall2.getFunctionIdentifier().equals(BuiltinOperators.DESCENDANT.getFunctionIdentifier()) || functionCall2.getFunctionIdentifier().equals( BuiltinOperators.DESCENDANT_OR_SELF.getFunctionIdentifier())) { return false; } // Find unnest2 variable in unnest1 Mutable<ILogicalExpression> unnest1Arg = ExpressionToolbox.findVariableExpression(unnest1.getExpressionRef(), unnest2.getVariable()); if (unnest1Arg == null) { return false; } // Replace unnest2 expression in unnest1 ScalarFunctionCallExpression child = new ScalarFunctionCallExpression(functionInfo2, functionCall2.getArguments()); unnest1Arg.setValue(child); // Move input for unnest2 into unnest1 unnest1.getInputs().clear(); unnest1.getInputs().addAll(unnest2.getInputs()); return true; }