Package org.apache.druid.query
Class BaseQuery<T>
java.lang.Object
org.apache.druid.query.BaseQuery<T>
- All Implemented Interfaces:
Query<T>
- Direct Known Subclasses:
DataSourceMetadataQuery,GroupByQuery,ScanQuery,SearchQuery,SegmentMetadataQuery,TimeBoundaryQuery,TimeseriesQuery,TopNQuery,WindowOperatorQuery
-
Field Summary
FieldsFields inherited from interface org.apache.druid.query.Query
DATASOURCE_METADATA, GROUP_BY, SCAN, SEARCH, SEGMENT_METADATA, SELECT, TIME_BOUNDARY, TIMESERIES, TOPN, UNION_QUERY, WINDOW_OPERATOR -
Constructor Summary
ConstructorsConstructorDescriptionBaseQuery(DataSource dataSource, QuerySegmentSpec querySegmentSpec, Map<String, Object> context) BaseQuery(DataSource dataSource, QuerySegmentSpec querySegmentSpec, Map<String, Object> context, Granularity granularity) -
Method Summary
Modifier and TypeMethodDescriptionstatic org.joda.time.DurationcalculateDuration(Collection<org.joda.time.Interval> intervals) static voidcomputeOverridenContext(Map<String, Object> overrides) Deprecated.context()Returns the query context as aQueryContext, which provides convenience methods for accessing typed context values.booleanReturns the context as an (immutable) map.org.joda.time.DurationgetId()List<org.joda.time.Interval> com.google.common.collect.Ordering<T> Default implementation ofQuery.getResultOrdering()that usesOrdering.natural().getRunner(QuerySegmentWalker walker) Returns the subQueryId of this query.org.joda.time.DateTimeZoneinthashCode()withSqlQueryId(String sqlQueryId) withSubQueryId(String subQueryId) Returns a copy of this query with a new subQueryId (seeQuery.getSubQueryId().Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.query.Query
getContextBoolean, getContextHumanReadableBytes, getContextValue, getFilter, getMostSpecificId, getRequiredColumns, getResultRowSignature, getResultRowSignature, getSingleInterval, getSqlQueryId, getType, getVirtualColumns, hasFilters, mayCollapseQueryDataSource, optimizeForSegment, withDataSource, withDefaultSubQueryId, withLane, withOverriddenContext, withPriority, withQuerySegmentSpec
-
Field Details
-
QUERY_ID
- See Also:
-
SUB_QUERY_ID
- See Also:
-
SQL_QUERY_ID
- See Also:
-
-
Constructor Details
-
BaseQuery
public BaseQuery(DataSource dataSource, QuerySegmentSpec querySegmentSpec, Map<String, Object> context) -
BaseQuery
public BaseQuery(DataSource dataSource, QuerySegmentSpec querySegmentSpec, Map<String, Object> context, Granularity granularity)
-
-
Method Details
-
checkInterrupted
public static void checkInterrupted() -
getDataSource
- Specified by:
getDataSourcein interfaceQuery<T>
-
getQuerySegmentSpec
-
getRunner
-
getIntervals
- Specified by:
getIntervalsin interfaceQuery<T>
-
getDuration
public org.joda.time.Duration getDuration()- Specified by:
getDurationin interfaceQuery<T>
-
calculateDuration
public static org.joda.time.Duration calculateDuration(Collection<org.joda.time.Interval> intervals) -
getGranularity
- Specified by:
getGranularityin interfaceQuery<T>
-
getTimezone
public org.joda.time.DateTimeZone getTimezone()- Specified by:
getTimezonein interfaceQuery<T>
-
getContext
Description copied from interface:QueryReturns the context as an (immutable) map.- Specified by:
getContextin interfaceQuery<T>
-
context
Description copied from interface:QueryReturns the query context as aQueryContext, which provides convenience methods for accessing typed context values. The returned instance is a view on top of the context provided byQuery.getContext().The default implementation is for backward compatibility. Derived classes should store and return the
QueryContextdirectly. -
computeOverridenContext
Deprecated.usecomputeOverriddenContext(getContext(), overrides))instead. This method may be removed in the next minor or major version of Druid. -
computeOverriddenContext
-
getResultOrdering
Default implementation ofQuery.getResultOrdering()that usesOrdering.natural(). If your query result type T is not Comparable, you must override this method.- Specified by:
getResultOrderingin interfaceQuery<T>
-
getId
-
withSubQueryId
Description copied from interface:QueryReturns a copy of this query with a new subQueryId (seeQuery.getSubQueryId().- Specified by:
withSubQueryIdin interfaceQuery<T>
-
getSubQueryId
Description copied from interface:QueryReturns the subQueryId of this query. This is set by ClientQuerySegmentWalker (the entry point for the Broker's query stack) on any subqueries that it issues. It is null for the main query.- Specified by:
getSubQueryIdin interfaceQuery<T>
-
withId
-
withSqlQueryId
- Specified by:
withSqlQueryIdin interfaceQuery<T>
-
equals
-
hashCode
public int hashCode()
-
computeOverriddenContext(getContext(), overrides))instead.