public interface Query<T>
| Modifier and Type | Field and Description |
|---|---|
static String |
DATASOURCE_METADATA |
static String |
GROUP_BY |
static String |
SCAN |
static String |
SEARCH |
static String |
SEGMENT_METADATA |
static String |
SELECT |
static String |
TIME_BOUNDARY |
static String |
TIMESERIES |
static String |
TOPN |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
getContext() |
boolean |
getContextBoolean(String key,
boolean defaultValue) |
<ContextType> |
getContextValue(String key) |
<ContextType> |
getContextValue(String key,
ContextType defaultValue) |
DataSource |
getDataSource() |
org.joda.time.Duration |
getDuration() |
DimFilter |
getFilter() |
Granularity |
getGranularity() |
String |
getId() |
List<org.joda.time.Interval> |
getIntervals() |
default String |
getMostSpecificId()
Returns a most specific ID of this query; if it is a subquery, this will return its subquery ID.
|
default Set<String> |
getRequiredColumns()
Returns the set of columns that this query will need to access out of its datasource.
|
com.google.common.collect.Ordering<T> |
getResultOrdering()
Comparator that represents the order in which results are generated from the
QueryRunnerFactory.createRunner(Segment) and
QueryRunnerFactory.mergeRunners(QueryProcessingPool, Iterable) calls. |
QueryRunner<T> |
getRunner(QuerySegmentWalker walker) |
default String |
getSqlQueryId() |
String |
getSubQueryId()
Returns the subQueryId of this query.
|
org.joda.time.DateTimeZone |
getTimezone() |
String |
getType() |
default VirtualColumns |
getVirtualColumns() |
boolean |
hasFilters() |
boolean |
isDescending() |
default Query<T> |
optimizeForSegment(PerSegmentQueryOptimizationContext optimizationContext) |
Query<T> |
withDataSource(DataSource dataSource) |
default Query<T> |
withDefaultSubQueryId() |
Query<T> |
withId(String id) |
default Query<T> |
withLane(String lane) |
Query<T> |
withOverriddenContext(Map<String,Object> contextOverride) |
default Query<T> |
withPriority(int priority) |
Query<T> |
withQuerySegmentSpec(QuerySegmentSpec spec)
Returns a new query, identical to this one, but with a different associated
QuerySegmentSpec. |
default Query<T> |
withSqlQueryId(String sqlQueryId) |
Query<T> |
withSubQueryId(String subQueryId)
Returns a copy of this query with a new subQueryId (see
getSubQueryId(). |
static final String TIMESERIES
static final String SEARCH
static final String TIME_BOUNDARY
static final String GROUP_BY
static final String SCAN
static final String SEGMENT_METADATA
static final String SELECT
static final String TOPN
static final String DATASOURCE_METADATA
DataSource getDataSource()
boolean hasFilters()
DimFilter getFilter()
String getType()
QueryRunner<T> getRunner(QuerySegmentWalker walker)
List<org.joda.time.Interval> getIntervals()
org.joda.time.Duration getDuration()
Granularity getGranularity()
org.joda.time.DateTimeZone getTimezone()
<ContextType> ContextType getContextValue(String key)
<ContextType> ContextType getContextValue(String key, ContextType defaultValue)
boolean getContextBoolean(String key, boolean defaultValue)
boolean isDescending()
com.google.common.collect.Ordering<T> getResultOrdering()
QueryRunnerFactory.createRunner(Segment) and
QueryRunnerFactory.mergeRunners(QueryProcessingPool, Iterable) calls. This is used to combine streams of
results from different sources; for example, it's used by historicals to combine streams from different segments,
and it's used by the broker to combine streams from different historicals.
Important note: sometimes, this ordering is used in a type-unsafe way to order @{code ResultOrdering.natural() when they are given an
object that is not of type T.Query<T> withQuerySegmentSpec(QuerySegmentSpec spec)
QuerySegmentSpec.
This often changes the behavior of 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).Query<T> withSubQueryId(String subQueryId)
getSubQueryId().@Nullable String getSubQueryId()
default String getMostSpecificId()
withId(java.lang.String) or withSubQueryId(java.lang.String).Query<T> withDataSource(DataSource dataSource)
default Query<T> optimizeForSegment(PerSegmentQueryOptimizationContext optimizationContext)
default VirtualColumns getVirtualColumns()
@Nullable default Set<String> getRequiredColumns()
QueryDataSource, 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.Copyright © 2011–2021 The Apache Software Foundation. All rights reserved.