Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public Expr ExprOfQueryRef(bool hasAggFunc)
        {
            Expr expr = this;

            Debug.Assert(bounded_);
            if (tabRef_ is FromQueryRef tf)
            {
                var repl = tf.MapOutputName(outputName_);
                if (hasAggFunc && repl.HasAggFunc())
                {
                    expr = new AggrRef(repl, -1);
                }
                else
                {
                    expr = repl;
                }
            }
            return(expr);
        }