if (!query.toString().contains("GROUP")) { if (expr.getAggregator().toString().contains("DISTINCT")) traversal = traversal.dedup(expr.getAggregator().getExprList().get(0).toString().substring(1)); else traversal = traversal.select(expr.getAggregator().getExprList().get(0).toString().substring(1));
/** * Convert an aggregator to a function object. * By this we can use the same infrastructure * as being used for all other types of functions. * * @param agg * @return */ public static E_Function aggregatorToFunction(Aggregator agg) { ExprList args = agg.getExprList(); /* Expr arg = agg.getExpr(); ExprList args = new ExprList(); if(arg != null) { args.add(arg); }*/ if(args == null) { args = new ExprList(); } String fnName = agg.getClass().getSimpleName(); E_Function result = new E_Function(fnName, args); return result; }
public Expr copy(Var v) { return new ExprAggregator(v, aggregator.copy(aggregator.getExprList())) ; }
@Override public void visit(OpGroup op) { List<ExprAggregator> exprAggs = op.getAggregators(); Multimap<Var, Var> updates = HashMultimap.create(); exprAggs.forEach(ea -> { Var v = ea.getVar(); ExprList el = ea.getAggregator().getExprList(); Set<Var> vars = ExprVars.getVarsMentioned(el); Set<Var> origVars = MultimapUtils.getAll(varDeps, vars); // It is possible that a variable did not occurr in the sub tree under investigation // in that case add it to the mapping if(origVars.isEmpty()) { origVars = Collections.singleton(v); } //referencedVars.addAll(origVars); updates.putAll(v, origVars); }); updates.asMap().forEach((k, w) -> { nonUnique.addAll(w); varDeps.replaceValues(k, w); }); VarExprList groupVars = op.getGroupVars(); processExtend(groupVars); }
@Override public void visit(OpGroup op) { List<ExprAggregator> exprAggs = op.getAggregators(); Multimap<Var, Var> updates = HashMultimap.create(); exprAggs.forEach(ea -> { Var v = ea.getVar(); ExprList el = ea.getAggregator().getExprList(); Set<Var> vars = ExprVars.getVarsMentioned(el); Set<Var> origVars = MultimapUtils.getAll(varDeps, vars); // It is possible that a variable did not occurr in the sub tree under investigation // in that case add it to the mapping if(origVars.isEmpty()) { origVars = Collections.singleton(v); } //referencedVars.addAll(origVars); updates.putAll(v, origVars); }); updates.asMap().forEach((k, w) -> { nonUnique.addAll(w); varDeps.replaceValues(k, w); }); VarExprList groupVars = op.getGroupVars(); processExtend(groupVars); }
for(Expr expr : agg.getExprList()) { Set<Var> tmp = expr.getVarsMentioned(); varRefs.addAll(tmp);
public Expr _transform(ExprAggregator eAgg) { ExprList newAggExpr = this.transformMM(eAgg.getAggregator().getExprList()); Aggregator newAgg = eAgg.getAggregator().copy(newAggExpr); Expr newAggVar = this.transformMM(eAgg.getAggVar()); //ExprCopy.getInstance().copy(expr, eAgg.get) Expr result = new ExprAggregator(newAggVar.asVar(), newAgg); return result; //System.out.println("Aggregate"); //eAgg.getAggregator(). //AggCount //eAgg.get //throw new NotImplementedException(); } }
ExprList e = aggregator.getExprList() ; ExprList e2 = e ; if ( e != null )
ExprList exprList = ag.getExprList(); if(exprList.size()!=1) { return null; ExprList exprList = ag.getExprList(); if(exprList.size()!=1) { return null;