public abstract class BaseQuery<T> extends Object implements Query<T>
| Modifier and Type | Field and Description |
|---|---|
static String |
QUERY_ID |
static String |
SQL_QUERY_ID |
static String |
SUB_QUERY_ID |
DATASOURCE_METADATA, GROUP_BY, SCAN, SEARCH, SEGMENT_METADATA, SELECT, TIME_BOUNDARY, TIMESERIES, TOPN, WINDOW_OPERATOR| Constructor and Description |
|---|
BaseQuery(DataSource dataSource,
QuerySegmentSpec querySegmentSpec,
boolean descending,
Map<String,Object> context) |
BaseQuery(DataSource dataSource,
QuerySegmentSpec querySegmentSpec,
boolean descending,
Map<String,Object> context,
Granularity granularity) |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkInterrupted() |
static Map<String,Object> |
computeOverriddenContext(Map<String,Object> context,
Map<String,Object> overrides) |
protected Map<String,Object> |
computeOverridenContext(Map<String,Object> overrides)
Deprecated.
use
computeOverriddenContext(getContext(), overrides))
instead. This method may be removed in the next minor or major version of Druid. |
QueryContext |
context()
Returns the query context as a
QueryContext, which provides
convenience methods for accessing typed context values. |
boolean |
equals(Object o) |
Map<String,Object> |
getContext()
Returns the context as an (immutable) map.
|
DataSource |
getDataSource() |
org.joda.time.Duration |
getDuration() |
Granularity |
getGranularity() |
String |
getId() |
List<org.joda.time.Interval> |
getIntervals() |
QuerySegmentSpec |
getQuerySegmentSpec() |
static QuerySegmentSpec |
getQuerySegmentSpecForLookUp(BaseQuery<?> query) |
com.google.common.collect.Ordering<T> |
getResultOrdering()
Default implementation of
Query.getResultOrdering() that uses Ordering.natural(). |
QueryRunner<T> |
getRunner(QuerySegmentWalker walker) |
String |
getSubQueryId()
Returns the subQueryId of this query.
|
org.joda.time.DateTimeZone |
getTimezone() |
int |
hashCode() |
boolean |
isDescending() |
Query<T> |
withId(String id) |
Query<T> |
withSqlQueryId(String sqlQueryId) |
Query<T> |
withSubQueryId(String subQueryId)
Returns a copy of this query with a new subQueryId (see
Query.getSubQueryId(). |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetContextBoolean, getContextHumanReadableBytes, getContextValue, getFilter, getMostSpecificId, getRequiredColumns, getSqlQueryId, getType, getVirtualColumns, hasFilters, optimizeForSegment, withDataSource, withDefaultSubQueryId, withLane, withOverriddenContext, withPriority, withQuerySegmentSpecpublic static final String QUERY_ID
public static final String SUB_QUERY_ID
public static final String SQL_QUERY_ID
public BaseQuery(DataSource dataSource, QuerySegmentSpec querySegmentSpec, boolean descending, Map<String,Object> context)
public BaseQuery(DataSource dataSource, QuerySegmentSpec querySegmentSpec, boolean descending, Map<String,Object> context, Granularity granularity)
public static void checkInterrupted()
public DataSource getDataSource()
getDataSource in interface Query<T>public boolean isDescending()
isDescending in interface Query<T>public QuerySegmentSpec getQuerySegmentSpec()
public QueryRunner<T> getRunner(QuerySegmentWalker walker)
public static QuerySegmentSpec getQuerySegmentSpecForLookUp(BaseQuery<?> query)
public List<org.joda.time.Interval> getIntervals()
getIntervals in interface Query<T>public org.joda.time.Duration getDuration()
getDuration in interface Query<T>public Granularity getGranularity()
getGranularity in interface Query<T>public org.joda.time.DateTimeZone getTimezone()
getTimezone in interface Query<T>public Map<String,Object> getContext()
QuerygetContext in interface Query<T>public QueryContext context()
QueryQueryContext, which provides
convenience methods for accessing typed context values. The returned
instance is a view on top of the context provided by Query.getContext().
The default implementation is for backward compatibility. Derived classes should
store and return the QueryContext directly.
@Deprecated protected Map<String,Object> computeOverridenContext(Map<String,Object> overrides)
computeOverriddenContext(getContext(), overrides))
instead. This method may be removed in the next minor or major version of Druid.public static Map<String,Object> computeOverriddenContext(Map<String,Object> context, Map<String,Object> overrides)
public com.google.common.collect.Ordering<T> getResultOrdering()
Query.getResultOrdering() that uses Ordering.natural().
If your query result type T is not Comparable, you must override this method.getResultOrdering in interface Query<T>public Query<T> withSubQueryId(String subQueryId)
QueryQuery.getSubQueryId().withSubQueryId in interface Query<T>@Nullable public String getSubQueryId()
QuerygetSubQueryId in interface Query<T>public Query<T> withSqlQueryId(String sqlQueryId)
withSqlQueryId in interface Query<T>Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.