public class Queries extends Object
| Constructor and Description |
|---|
Queries() |
| Modifier and Type | Method and Description |
|---|---|
static Set<String> |
computeRequiredColumns(VirtualColumns virtualColumns,
DimFilter filter,
List<DimensionSpec> dimensions,
List<AggregatorFactory> aggregators,
List<String> additionalColumns)
Helper for implementations of
Query.getRequiredColumns(). |
static List<PostAggregator> |
decoratePostAggregators(List<PostAggregator> postAggs,
Map<String,AggregatorFactory> aggFactories) |
static List<PostAggregator> |
prepareAggregations(List<AggregatorFactory> aggFactories,
List<PostAggregator> postAggs)
Deprecated.
|
static List<PostAggregator> |
prepareAggregations(List<String> otherOutputNames,
List<AggregatorFactory> aggFactories,
List<PostAggregator> postAggs)
Returns decorated post-aggregators, based on original un-decorated post-aggregators.
|
static <T> Query<T> |
withBaseDataSource(Query<T> query,
DataSource newBaseDataSource)
Rewrite "query" to refer to some specific base datasource, instead of the one it currently refers to.
|
static <T> Query<T> |
withDefaultTimeout(Query<T> query,
long defaultTimeout) |
static <T> Query<T> |
withMaxScatterGatherBytes(Query<T> query,
long maxScatterGatherBytesLimit) |
static <T> Query<T> |
withSpecificSegments(Query<T> query,
List<SegmentDescriptor> descriptors)
Rewrite "query" to refer to some specific segment descriptors.
|
static <T> Query<T> |
withTimeout(Query<T> query,
long timeout) |
public static List<PostAggregator> decoratePostAggregators(List<PostAggregator> postAggs, Map<String,AggregatorFactory> aggFactories)
@Deprecated public static List<PostAggregator> prepareAggregations(List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs)
prepareAggregations(List, List, List) but with otherOutputNames as an empty list. Deprecated
because it makes it easy to forget to include dimensions, etc. in "otherOutputNames".aggFactories - aggregator factories for this querypostAggs - post-aggregators for this queryNullPointerException - if aggFactories is nullIllegalArgumentException - if there are any output name collisions or missing post-aggregator inputspublic static List<PostAggregator> prepareAggregations(List<String> otherOutputNames, List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs)
otherOutputNames - names of fields that will appear in the same output namespace as aggregators and
post-aggregators, and are also assumed to be valid inputs to post-aggregators. For most
built-in query types, this is either empty, or the list of dimension output names.aggFactories - aggregator factories for this querypostAggs - post-aggregators for this queryNullPointerException - if otherOutputNames or aggFactories is nullIllegalArgumentException - if there are any output name collisions or missing post-aggregator inputspublic static <T> Query<T> withSpecificSegments(Query<T> query, List<SegmentDescriptor> descriptors)
query.withQuerySegmentSpec(new MultipleSpecificSegmentSpec(descriptors)),
this this method will walk down subqueries found within the query datasource, if any, and modify the lowest-level
subquery. The effect is that
DataSourceAnalysis.forDataSource(query.getDataSource()).getBaseQuerySegmentSpec() is guaranteed to return
either new MultipleSpecificSegmentSpec(descriptors) or empty.
Because BaseQuery.getRunner(org.apache.druid.query.QuerySegmentWalker) is implemented using DataSourceAnalysis.getBaseQuerySegmentSpec(), this
method will cause the runner to be a specific-segments runner.public static <T> Query<T> withBaseDataSource(Query<T> query, DataSource newBaseDataSource)
Query.withDataSource(org.apache.druid.query.DataSource), this will walk down the datasource tree and replace
only the base datasource (in the sense defined in DataSourceAnalysis).public static Set<String> computeRequiredColumns(VirtualColumns virtualColumns, @Nullable DimFilter filter, List<DimensionSpec> dimensions, List<AggregatorFactory> aggregators, List<String> additionalColumns)
Query.getRequiredColumns(). Returns the list of columns that will be read
out of a datasource by a query that uses the provided objects in the usual way.
The returned set always contains __time, no matter what.
If the virtual columns, filter, dimensions, aggregators, or additional columns refer to a virtual column, then the
inputs of the virtual column will be returned instead of the name of the virtual column itself. Therefore, the
returned list will never contain the names of any virtual columns.virtualColumns - virtual columns whose inputs should be included.filter - optional filter whose inputs should be included.dimensions - dimension specs whose inputs should be included.aggregators - aggregators whose inputs should be included.additionalColumns - additional columns to include. Each of these will be added to the returned set, unless it
refers to a virtual column, in which case the virtual column inputs will be added instead.public static <T> Query<T> withMaxScatterGatherBytes(Query<T> query, long maxScatterGatherBytesLimit)
Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.