Class DefaultLimitSpec
java.lang.Object
org.apache.druid.query.groupby.orderby.DefaultLimitSpec
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDefaultLimitSpec(List<OrderByColumnSpec> columns, Integer limit) Constructor that does not accept "offset".DefaultLimitSpec(List<OrderByColumnSpec> columns, Integer offset, Integer limit) -
Method Summary
Modifier and TypeMethodDescriptionbuild(GroupByQuery query) Returns a function that applies a limit to an input sequence that is assumed to be sorted on dimensions.static DefaultLimitSpec.Builderbuilder()booleanfilterColumns(Set<String> names) Discard sorting columns not contained in given set.byte[]Get a byte array used as a cache key.static StringComparatorgetComparatorForDimName(DefaultLimitSpec limitSpec, String dimName) intgetLimit()Limit for this query; behaves like SQL "LIMIT".intOffset for this query; behaves like SQL "OFFSET".inthashCode()booleanbooleanisOffset()static booleansortingOrderHasNonGroupingFields(DefaultLimitSpec limitSpec, List<DimensionSpec> dimensions) Check if a limitSpec has columns in the sorting order that are not part of the grouping fields represented by `dimensions`.toString()Returns a new DefaultLimitSpec identical to this one except for one difference: an offset parameter, if any, will be removed and added to the limit.
-
Constructor Details
-
DefaultLimitSpec
-
DefaultLimitSpec
Constructor that does not accept "offset". Useful for tests that only want to provide "columns" and "limit".
-
-
Method Details
-
builder
-
sortingOrderHasNonGroupingFields
public static boolean sortingOrderHasNonGroupingFields(DefaultLimitSpec limitSpec, List<DimensionSpec> dimensions) Check if a limitSpec has columns in the sorting order that are not part of the grouping fields represented by `dimensions`.- Parameters:
limitSpec- LimitSpec, assumed to be non-nulldimensions- Grouping fields for a groupBy query- Returns:
- True if limitSpec has sorting columns not contained in dimensions
-
getComparatorForDimName
-
getColumns
-
getOffset
public int getOffset()Offset for this query; behaves like SQL "OFFSET". Zero means no offset. Negative values are invalid. -
getLimit
public int getLimit()Limit for this query; behaves like SQL "LIMIT". Will always be positive.Integer.MAX_VALUEis used in situations where the user wants an effectively unlimited result set. -
isOffset
public boolean isOffset() -
isLimited
public boolean isLimited() -
build
public com.google.common.base.Function<Sequence<ResultRow>,Sequence<ResultRow>> build(GroupByQuery query) Description copied from interface:LimitSpecReturns a function that applies a limit to an input sequence that is assumed to be sorted on dimensions. -
filterColumns
Description copied from interface:LimitSpecDiscard sorting columns not contained in given set. This is used when generating new queries, e.g. to process subtotal spec in GroupBy query.- Specified by:
filterColumnsin interfaceLimitSpec- Parameters:
names- columns names to keep- Returns:
- new LimitSpec that works with fitlered set of columns
-
withOffsetToLimit
Returns a new DefaultLimitSpec identical to this one except for one difference: an offset parameter, if any, will be removed and added to the limit. This is designed for passing down queries to lower levels of the stack. Only the highest level should apply the offset parameter, and any pushed-down limits must be increased to accommodate the offset. -
toString
-
equals
-
hashCode
public int hashCode() -
getCacheKey
public byte[] getCacheKey()Description copied from interface:CacheableGet a byte array used as a cache key.- Specified by:
getCacheKeyin interfaceCacheable- Returns:
- bytes to be used as cache key - or null if this object should not be cached.
-