public override Expr SplitAgg() { var child = child_(); // child of tsum/tcount will be replace to bypass aggfunc child during aggfunc intialization var tsum = new AggSum(new List <Expr> { child }); tsum.dummyBind(); var sumchild = new AggSum(new List <Expr> { child.Clone() }); sumchild.dummyBind(); var sumchildref = new AggrRef(sumchild, -1); tsum.children_[0] = sumchildref; var tcount = new AggSum(new List <Expr> { child }); tcount.dummyBind(); var countchild = new AggCount(new List <Expr> { child.Clone() }); countchild.dummyBind(); var countchildref = new AggrRef(countchild, -1); tcount.children_[0] = countchildref; var processed = new BinExpr(tsum, tcount, "/"); processed.dummyBind(); return(processed); }
public static BinExpr MakeBooleanExpr(Expr l, Expr r, string op) { Debug.Assert(l.bounded_ && r.bounded_); var expr = new BinExpr(l, r, op); expr.ResetAggregateTableRefs(); expr.markBounded(); expr.type_ = new BoolType(); return(expr); }
public static Expr MakeFullComparator(List <Expr> left, List <Expr> right) { // a rough check here - caller's responsiblity to do a full check Debug.Assert(left.Count == right.Count); Expr result = BinExpr.MakeBooleanExpr(left[0], right[0], "="); for (int i = 1; i < left.Count; i++) { Expr qual = BinExpr.MakeBooleanExpr(left[i], right[i], "="); result = result.AddAndFilter(qual); } return(result); }