| Modifier and Type | Class and Description |
|---|---|
static class |
GroupByQuery.Builder |
| Modifier and Type | Field and Description |
|---|---|
static String |
CTX_KEY_SORT_BY_DIMS_FIRST |
static String |
CTX_TIMESTAMP_RESULT_FIELD |
static String |
CTX_TIMESTAMP_RESULT_FIELD_GRANULARITY |
static String |
CTX_TIMESTAMP_RESULT_FIELD_INDEX |
QUERY_ID, SQL_QUERY_ID, SUB_QUERY_IDDATASOURCE_METADATA, GROUP_BY, SCAN, SEARCH, SEGMENT_METADATA, SELECT, TIME_BOUNDARY, TIMESERIES, TOPN| Constructor and Description |
|---|
GroupByQuery(DataSource dataSource,
QuerySegmentSpec querySegmentSpec,
VirtualColumns virtualColumns,
DimFilter dimFilter,
Granularity granularity,
List<DimensionSpec> dimensions,
List<AggregatorFactory> aggregatorSpecs,
List<PostAggregator> postAggregatorSpecs,
HavingSpec havingSpec,
LimitSpec limitSpec,
List<List<String>> subtotalsSpec,
Map<String,Object> context) |
| Modifier and Type | Method and Description |
|---|---|
static GroupByQuery.Builder |
builder() |
boolean |
equals(Object o) |
List<AggregatorFactory> |
getAggregatorSpecs() |
boolean |
getApplyLimitPushDownFromContext() |
boolean |
getContextSortByDimsFirst() |
List<DimensionSpec> |
getDimensions() |
DimFilter |
getDimFilter() |
DimFilter |
getFilter() |
HavingSpec |
getHavingSpec() |
LimitSpec |
getLimitSpec() |
List<PostAggregator> |
getPostAggregatorSpecs() |
Set<String> |
getRequiredColumns()
Returns the set of columns that this query will need to access out of its datasource.
|
com.google.common.collect.Ordering |
getResultOrdering()
Default implementation of
Query.getResultOrdering() that uses Ordering.natural(). |
int |
getResultRowAggregatorStart()
Returns the position of the first aggregator in ResultRows for this query.
|
int |
getResultRowDimensionStart()
Returns the position of the first dimension in ResultRows for this query.
|
boolean |
getResultRowHasTimestamp()
Returns true if ResultRows for this query include timestamps, false otherwise.
|
int |
getResultRowPostAggregatorStart()
Returns the position of the first post-aggregator in ResultRows for this query.
|
RowSignature |
getResultRowSignature()
Equivalent to
getResultRowSignature(Finalization.UNKNOWN). |
RowSignature |
getResultRowSignature(RowSignature.Finalization finalization)
Returns a result row signature, of the same size as
getResultRowSizeWithPostAggregators(), in the
order that they will appear in ResultRows for this query. |
int |
getResultRowSizeWithoutPostAggregators()
Returns the size of ResultRows for this query when they do not include post-aggregators.
|
int |
getResultRowSizeWithPostAggregators()
Returns the size of ResultRows for this query when they include post-aggregators.
|
com.google.common.collect.Ordering<ResultRow> |
getRowOrdering(boolean granular) |
List<List<String>> |
getSubtotalsSpec()
Subtotals spec may be empty which has a distinct meaning from
null. |
String |
getType() |
org.joda.time.DateTime |
getUniversalTimestamp()
If this query has a single universal timestamp, return it.
|
VirtualColumns |
getVirtualColumns() |
boolean |
hasFilters() |
int |
hashCode() |
boolean |
isApplyLimitPushDown() |
Sequence<ResultRow> |
postProcess(Sequence<ResultRow> results)
Apply the havingSpec and limitSpec.
|
String |
toString() |
GroupByQuery |
withAggregatorSpecs(List<AggregatorFactory> aggregatorSpecs) |
Query<ResultRow> |
withDataSource(DataSource dataSource) |
GroupByQuery |
withDimensionSpecs(List<DimensionSpec> dimensionSpecs) |
GroupByQuery |
withDimFilter(DimFilter dimFilter) |
GroupByQuery |
withLimitSpec(LimitSpec limitSpec) |
GroupByQuery |
withOverriddenContext(Map<String,Object> contextOverride) |
GroupByQuery |
withPostAggregatorSpecs(List<PostAggregator> postAggregatorSpecs) |
GroupByQuery |
withQuerySegmentSpec(QuerySegmentSpec spec)
Returns a new query, identical to this one, but with a different associated
QuerySegmentSpec. |
GroupByQuery |
withSubtotalsSpec(List<List<String>> subtotalsSpec) |
GroupByQuery |
withVirtualColumns(VirtualColumns virtualColumns) |
checkInterrupted, computeOverriddenContext, computeOverridenContext, context, getContext, getDataSource, getDuration, getGranularity, getId, getIntervals, getQuerySegmentSpec, getQuerySegmentSpecForLookUp, getRunner, getSubQueryId, getTimezone, isDescending, withId, withSqlQueryId, withSubQueryIdclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetContextBoolean, getContextHumanReadableBytes, getContextValue, getMostSpecificId, getSqlQueryId, optimizeForSegment, withDefaultSubQueryId, withLane, withPrioritypublic static final String CTX_KEY_SORT_BY_DIMS_FIRST
public static final String CTX_TIMESTAMP_RESULT_FIELD
public static final String CTX_TIMESTAMP_RESULT_FIELD_GRANULARITY
public static final String CTX_TIMESTAMP_RESULT_FIELD_INDEX
public GroupByQuery(DataSource dataSource, QuerySegmentSpec querySegmentSpec, VirtualColumns virtualColumns, @Nullable DimFilter dimFilter, Granularity granularity, List<DimensionSpec> dimensions, List<AggregatorFactory> aggregatorSpecs, List<PostAggregator> postAggregatorSpecs, @Nullable HavingSpec havingSpec, @Nullable LimitSpec limitSpec, @Nullable List<List<String>> subtotalsSpec, Map<String,Object> context)
public static GroupByQuery.Builder builder()
public VirtualColumns getVirtualColumns()
public List<DimensionSpec> getDimensions()
public List<AggregatorFactory> getAggregatorSpecs()
public List<PostAggregator> getPostAggregatorSpecs()
public HavingSpec getHavingSpec()
public LimitSpec getLimitSpec()
@Nullable public List<List<String>> getSubtotalsSpec()
null.public RowSignature getResultRowSignature()
getResultRowSignature(Finalization.UNKNOWN).public RowSignature getResultRowSignature(RowSignature.Finalization finalization)
getResultRowSizeWithPostAggregators(), in the
order that they will appear in ResultRows for this query.
Aggregator types in the signature depend on the value of finalization.
If finalization is RowSignature.Finalization#UNKNOWN, this method returns a cached object.public int getResultRowSizeWithoutPostAggregators()
public int getResultRowSizeWithPostAggregators()
@Nullable public org.joda.time.DateTime getUniversalTimestamp()
BaseQuery.getIntervals() is empty, there are no results (or timestamps) so this method returns null.
This method will return a nonnull timestamp in the following two cases:
1) CTX_KEY_FUDGE_TIMESTAMP is set (in which case this timestamp will be returned).
2) Granularity is "ALL".
If this method returns null, then getResultRowHasTimestamp() will return true. The reverse is also true:
if this method returns nonnull, then getResultRowHasTimestamp() will return false.public boolean getResultRowHasTimestamp()
public int getResultRowDimensionStart()
public int getResultRowAggregatorStart()
public int getResultRowPostAggregatorStart()
public boolean hasFilters()
public String getType()
public boolean getContextSortByDimsFirst()
public boolean isApplyLimitPushDown()
public boolean getApplyLimitPushDownFromContext()
public com.google.common.collect.Ordering getResultOrdering()
BaseQueryQuery.getResultOrdering() that uses Ordering.natural().
If your query result type T is not Comparable, you must override this method.getResultOrdering in interface Query<ResultRow>getResultOrdering in class BaseQuery<ResultRow>public com.google.common.collect.Ordering<ResultRow> getRowOrdering(boolean granular)
public Sequence<ResultRow> postProcess(Sequence<ResultRow> results)
results - sequence of rows to apply havingSpec and limitSpec to@Nullable public Set<String> getRequiredColumns()
QueryQueryDataSource, this method will not return the columns used by that subquery. As another example, if a
query is built on a JoinDataSource, this method will not return the columns from the underlying datasources
that are used by the join condition, unless those columns are also used by this query in other ways.
Returns null if the set of required columns cannot be known ahead of time.public GroupByQuery withOverriddenContext(Map<String,Object> contextOverride)
public GroupByQuery withQuerySegmentSpec(QuerySegmentSpec spec)
QueryQuerySegmentSpec.
This often changes the behavior of Query.getRunner(QuerySegmentWalker), since most queries inherit that method
from BaseQuery, which implements it by calling QuerySegmentSpec.lookup(org.apache.druid.query.Query<T>, org.apache.druid.query.QuerySegmentWalker).public GroupByQuery withVirtualColumns(VirtualColumns virtualColumns)
public GroupByQuery withDimFilter(@Nullable DimFilter dimFilter)
public Query<ResultRow> withDataSource(DataSource dataSource)
public GroupByQuery withDimensionSpecs(List<DimensionSpec> dimensionSpecs)
public GroupByQuery withLimitSpec(LimitSpec limitSpec)
public GroupByQuery withAggregatorSpecs(List<AggregatorFactory> aggregatorSpecs)
public GroupByQuery withSubtotalsSpec(@Nullable List<List<String>> subtotalsSpec)
public GroupByQuery withPostAggregatorSpecs(List<PostAggregator> postAggregatorSpecs)
Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.