protected Map<Object, IExpressionAnnotation> cloneAnnotations() { Map<Object, IExpressionAnnotation> m = new HashMap<Object, IExpressionAnnotation>(); for (Object k : annotationMap.keySet()) { IExpressionAnnotation annot2 = annotationMap.get(k).copy(); m.put(k, annot2); } return m; }
private boolean processExpression(Mutable<ILogicalOperator> opRef, Mutable<ILogicalExpression> search) { boolean modified = false; functionList.clear(); ExpressionToolbox.findAllFunctionExpressions(search, functionList); for (Mutable<ILogicalExpression> searchM : functionList) { searchFunction = (AbstractFunctionCallExpression) searchM.getValue(); if (ALGEBRICKS_MAP.containsKey(searchFunction.getFunctionIdentifier())) { FunctionIdentifier fid = searchFunction.getFunctionIdentifier(); if (ALGEBRICKS_MAP.get(fid).first == null) { modified = convertAlgebricksExpression(searchM, ALGEBRICKS_MAP.get(fid).second, false); } else if (ALGEBRICKS_MAP.get(fid).second == null) { modified = convertAlgebricksExpression(searchM, ALGEBRICKS_MAP.get(fid).first, true); } else { IExpressionAnnotation annotate = searchFunction.getAnnotations().get( ALGEBRICKS_CONVERSION_ANNOTATION); if (((FunctionIdentifier) annotate.getObject()).equals(ALGEBRICKS_MAP.get(fid).first .getFunctionIdentifier())) { modified = convertAlgebricksExpression(searchM, ALGEBRICKS_MAP.get(fid).first, true); } else if (((FunctionIdentifier) annotate.getObject()).equals(ALGEBRICKS_MAP.get(fid).second .getFunctionIdentifier())) { modified = convertAlgebricksExpression(searchM, ALGEBRICKS_MAP.get(fid).second, false); } } } } return modified; }
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; }
return null; BroadcastSide side = (BroadcastSide) ann.getObject(); if (side == null) { return null;
@Override public AbstractLogicalExpression cloneExpression() { Map<Object, IExpressionAnnotation> m = new HashMap<>(); annotationMap.forEach((key, value1) -> m.put(key, value1.copy())); ConstantExpression c = new ConstantExpression(value); c.annotationMap = m; c.setSourceLocation(sourceLoc); return c; }
private void deepCopyAnnotations(AbstractFunctionCallExpression src, AbstractFunctionCallExpression dest) { Map<Object, IExpressionAnnotation> srcAnnotations = src.getAnnotations(); Map<Object, IExpressionAnnotation> destAnnotations = dest.getAnnotations(); srcAnnotations.forEach((key, value) -> destAnnotations.put(key, value.copy())); }