public SelectionOperator(LogicalOperator inOp, IList <SortItem> orderExprs, LimitClause limit) { FilterExpression = null; UnexpandedEntityInequalityConditions = null; SetInOperator(inOp); OrderByExpressions = orderExprs; Limit = limit; }
public void LimitClause(string expected, int size, int offset) { var clause = new LimitClause(size, offset); var sql = clause.ToString(); Output.WriteLine(sql); sql.ShouldBeEquivalentTo(expected); }
public SingleSeriesSelectStatement( SelectClause select, FromClause from, WhereClause where = null, GroupByClause groupBy = null, FillClause fill = null, OrderByClause orderBy = null, LimitClause limit = null, OffsetClause offset = null ) { Select = select ?? throw new ArgumentNullException(nameof(select)); From = from ?? throw new ArgumentNullException(nameof(from)); Where = where; GroupBy = groupBy; Fill = fill; OrderBy = orderBy; Limit = limit; Offset = offset; }
public DistributorPlan Plan(Query input) { SelectClause underlyingSelect = null; Option <LimitClause> underlyingLimit = new None(); Option <OrderClause> order = new None(); Option <LimitClause> limit = new None(); if (input.Order.IsSome) { var builder = new PlanOrderBuilder(input, input.Order.AsT0); underlyingSelect = builder.UnderlyingSelect; order = builder.Order; } if (input.Limit.IsSome) { var limitValue = input.Limit.AsT0; limit = limitValue; // we can't sort on the underlying query so we need to load the whole result set if (input.Order.IsNone) { underlyingLimit = new LimitClause(limitValue.Limit); } } if (underlyingSelect == null) { underlyingSelect = input.Select; } var underlying = new Query(underlyingSelect, input.From, input.Where, new None(), underlyingLimit); return(new DistributorPlan(input, underlying, order, limit)); }
public SqlQuery Limit(int rows, bool percent = false) { _limitClause = new LimitClause(rows, percent); return(this); }
public static string CompileLimit(this LimitClause limit) { return(limit != null ? $"TOP {limit.LimitCommand}" : ""); }
public static void AssertEqual(LimitClause expected, LimitClause actual) { Assert.Equal(expected.Limit, actual.Limit); }