/** * Replace the original aggregate functions with their corresponding global aggregate function. */ protected void replaceOriginalAggFuncs(Set<SimilarAggregatesInfo> toReplaceSet) { for (SimilarAggregatesInfo sai : toReplaceSet) { for (AggregateExprInfo aei : sai.simAggs) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) aei.aggExprRef.getValue(); afce.setFunctionInfo(aei.newFunInfo); afce.getArguments().clear(); afce.getArguments().add(new MutableObject<>(sai.stepOneResult)); } } }
public boolean convertFunctionToAlgebricksExpression(Mutable<ILogicalExpression> searchM, AbstractFunctionCallExpression functionCall, IOptimizationContext context, Map<FunctionIdentifier, FunctionIdentifier> map) { if (map.containsKey(functionCall.getFunctionIdentifier())) { IExpressionAnnotation annotate = new ExpressionAnnotationNoCopyImpl(); annotate.setObject(functionCall.getFunctionIdentifier()); FunctionIdentifier algebricksFid = map.get(functionCall.getFunctionIdentifier()); IFunctionInfo algebricksFunction = context.getMetadataProvider().lookupFunction(algebricksFid); functionCall.setFunctionInfo(algebricksFunction); functionCall.getAnnotations().put(ALGEBRICKS_CONVERSION_ANNOTATION, annotate); searchM.setValue(functionCall); return true; } return false; }
@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; } }
} else { functionCall.setFunctionInfo(BuiltinOperators.SORT_NODES_ASC); operatorChanged = true; functionCall.setFunctionInfo(BuiltinOperators.DISTINCT_NODES_OR_ATOMICS); operatorChanged = true; } else {
functionCallSearch.setFunctionInfo(aggregateInfo);
childFnCall.setFunctionInfo(BuiltinOperators.DESCENDANT_OR_SELF); childFnCall.getArguments().get(0).setValue(afce.getArguments().get(0).getValue()); ILogicalOperator lo1 = opRef.getValue();
expr.setFunctionInfo(FunctionUtil.getFunctionInfo(BuiltinFunctions.CLOSED_RECORD_CONSTRUCTOR)); ASTERIX_LOGGER.trace(() -> "Switching to CLOSED record constructor in " + LogRedactionUtil.userData(expr.toString()) + ".\n");