public override RowSet RowSet(STransaction tr, SQuery top, SDict <long, SFunction> ags, Context cx)
        {
            for (var b = order.First(); b != null; b = b.Next())
            {
                ags = b.Value.col.Aggregates(ags, cx);
            }
            var ags1 = ags;

            for (var b = cpos.First(); b != null; b = b.Next())
            {
                ags1 = b.Value.Item2.Aggregates(ags1, cx);
            }
            RowSet r = new SelectRowSet(qry.RowSet(tr, this, ags1, cx), this, ags, cx);

            // perform another pass on the selectlist just in case
            if (!(qry is SGroupQuery))
            {
                for (var b = cpos.First(); b != null; b = b.Next())
                {
                    ags = b.Value.Item2.Aggregates(ags, cx);
                }
                if (ags.Length != 0)
                {
                    r = new EvalRowSet(((SelectRowSet)r)._source, this, ags, cx);
                }
            }
            if (distinct)
            {
                r = new DistinctRowSet(r);
            }
            if (order.Length != 0)
            {
                r = new OrderedRowSet(r, this, cx);
            }
            return(r);
        }
 internal static DistinctRowBookmark?New(DistinctRowSet drs)
 {
     return((drs.rows.First() is Bookmark <ValueTuple <SRow, bool> > rb) ?
            new DistinctRowBookmark(drs, rb, 0) : null);
 }
 DistinctRowBookmark(DistinctRowSet drs, Bookmark <ValueTuple <SRow, bool> > bmk, int pos)
     : base(drs, bmk.Value.Item1, pos)
 {
     _drs = drs; _bmk = bmk;
 }