public class ScanQuery extends BaseQuery<ScanResultValue>
| Modifier and Type | Class and Description |
|---|---|
static class |
ScanQuery.Order |
static class |
ScanQuery.OrderBy |
static class |
ScanQuery.ResultFormat |
| Modifier and Type | Field and Description |
|---|---|
static String |
CTX_KEY_OUTERMOST
This context flag corresponds to whether the query is running on the "outermost" process (i.e.
|
static int |
DEFAULT_BATCH_SIZE |
QUERY_ID, SQL_QUERY_ID, SUB_QUERY_IDDATASOURCE_METADATA, GROUP_BY, SCAN, SEARCH, SEGMENT_METADATA, SELECT, TIME_BOUNDARY, TIMESERIES, TOPN, WINDOW_OPERATOR| Constructor and Description |
|---|
ScanQuery(DataSource dataSource,
QuerySegmentSpec querySegmentSpec,
VirtualColumns virtualColumns,
ScanQuery.ResultFormat resultFormat,
int batchSize,
long scanRowsOffset,
long scanRowsLimit,
ScanQuery.Order orderFromUser,
List<ScanQuery.OrderBy> orderBysFromUser,
DimFilter dimFilter,
List<String> columns,
Boolean legacy,
Map<String,Object> context) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int |
getBatchSize() |
List<String> |
getColumns() |
DimFilter |
getFilter() |
Integer |
getMaxRowsQueuedForOrdering() |
Integer |
getMaxSegmentPartitionsOrderedInMemory() |
List<ScanQuery.OrderBy> |
getOrderBys() |
Set<String> |
getRequiredColumns()
Returns the set of columns that this query will need to access out of its datasource.
|
ScanQuery.ResultFormat |
getResultFormat() |
com.google.common.collect.Ordering<ScanResultValue> |
getResultOrdering()
Default implementation of
Query.getResultOrdering() that uses Ordering.natural(). |
long |
getScanRowsLimit()
Limit for this query; behaves like SQL "LIMIT".
|
long |
getScanRowsOffset()
Offset for this query; behaves like SQL "OFFSET".
|
ScanQuery.Order |
getTimeOrder()
If this query is purely-time-ordered, returns a value of the enum
ScanQuery.Order. |
String |
getType() |
VirtualColumns |
getVirtualColumns() |
boolean |
hasFilters() |
int |
hashCode() |
Boolean |
isLegacy()
Compatibility mode with the legacy scan-query extension.
|
boolean |
isLimited()
Returns whether this query is limited or not.
|
String |
toString() |
static void |
verifyOrderByForNativeExecution(ScanQuery query)
Verifies that the ordering of a query is solely determined by
getTimeOrder(). |
ScanQuery |
withDataSource(DataSource dataSource) |
ScanQuery |
withLimit(long newLimit) |
ScanQuery |
withNonNullLegacy(ScanQueryConfig scanQueryConfig) |
ScanQuery |
withOffset(long newOffset) |
ScanQuery |
withOverriddenContext(Map<String,Object> contextOverrides) |
ScanQuery |
withQuerySegmentSpec(QuerySegmentSpec querySegmentSpec)
Returns a new query, identical to this one, but with a different associated
QuerySegmentSpec. |
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_OUTERMOST
public static final int DEFAULT_BATCH_SIZE
public ScanQuery(DataSource dataSource, QuerySegmentSpec querySegmentSpec, VirtualColumns virtualColumns, ScanQuery.ResultFormat resultFormat, int batchSize, long scanRowsOffset, long scanRowsLimit, ScanQuery.Order orderFromUser, List<ScanQuery.OrderBy> orderBysFromUser, DimFilter dimFilter, List<String> columns, Boolean legacy, Map<String,Object> context)
public static void verifyOrderByForNativeExecution(ScanQuery query)
getTimeOrder(). Required to actually
execute queries, because getOrderBys() is not yet understood by the query engines.IllegalStateException - if the ordering is not solely determined by getTimeOrder()public VirtualColumns getVirtualColumns()
public ScanQuery.ResultFormat getResultFormat()
public int getBatchSize()
public long getScanRowsOffset()
public long getScanRowsLimit()
Long.MAX_VALUE is used in
situations where the user wants an effectively unlimited result set.public boolean isLimited()
Long.MAX_VALUE is used to signify unlimitedness,
this is equivalent to getScanRowsLimit() != Long.Max_VALUE.getScanRowsLimit()public ScanQuery.Order getTimeOrder()
ScanQuery.Order. Otherwise, returns
ScanQuery.Order.NONE. If the returned value is ScanQuery.Order.NONE it may not agree with getOrderBys().public List<ScanQuery.OrderBy> getOrderBys()
@Nullable public Integer getMaxSegmentPartitionsOrderedInMemory()
public boolean hasFilters()
public String getType()
@Nullable public Boolean isLegacy()
ScanQueryConfig.isLegacy(). The method withNonNullLegacy(org.apache.druid.query.scan.ScanQueryConfig) is provided to help
with this.public com.google.common.collect.Ordering<ScanResultValue> 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<ScanResultValue>getResultOrdering in class BaseQuery<ScanResultValue>@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 ScanQuery withOffset(long newOffset)
public ScanQuery withLimit(long newLimit)
public ScanQuery withNonNullLegacy(ScanQueryConfig scanQueryConfig)
public ScanQuery withQuerySegmentSpec(QuerySegmentSpec querySegmentSpec)
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 ScanQuery withDataSource(DataSource dataSource)
public boolean equals(Object o)
equals in class BaseQuery<ScanResultValue>public int hashCode()
hashCode in class BaseQuery<ScanResultValue>Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.