public class WindowOperatorQueryQueryToolChest extends QueryToolChest<RowsAndColumns,WindowOperatorQuery>
| Constructor and Description |
|---|
WindowOperatorQueryQueryToolChest() |
| Modifier and Type | Method and Description |
|---|---|
com.fasterxml.jackson.core.type.TypeReference<RowsAndColumns> |
getResultTypeReference()
Returns a TypeReference object that is just passed through to Jackson in order to deserialize
the results of this type of query.
|
QueryMetrics<? super WindowOperatorQuery> |
makeMetrics(WindowOperatorQuery query)
Creates a
QueryMetrics object that is used to generate metrics for this specific query type. |
com.google.common.base.Function<RowsAndColumns,RowsAndColumns> |
makePreComputeManipulatorFn(WindowOperatorQuery query,
MetricManipulationFn fn)
Creates a Function that can take in a ResultType and return a new ResultType having applied
the MetricManipulatorFn to each of the metrics.
|
QueryRunner<RowsAndColumns> |
mergeResults(QueryRunner<RowsAndColumns> runner)
This method wraps a QueryRunner.
|
RowSignature |
resultArraySignature(WindowOperatorQuery query)
Returns a
RowSignature for the arrays returned by QueryToolChest.resultsAsArrays(QueryType, org.apache.druid.java.util.common.guava.Sequence<ResultType>). |
Sequence<Object[]> |
resultsAsArrays(WindowOperatorQuery query,
Sequence<RowsAndColumns> resultSequence)
Converts a sequence of this query's ResultType into arrays.
|
canPerformSubquery, createMergeFn, createResultComparator, decorateObjectMapper, filterSegments, getBaseResultType, getBySegmentResultType, getCacheStrategy, makePostComputeManipulatorFn, postMergeQueryDecoration, preMergeQueryDecoration, resultsAsFramespublic QueryRunner<RowsAndColumns> mergeResults(QueryRunner<RowsAndColumns> runner)
QueryToolChestResultMergeQueryRunner which creates a
CombiningSequence using the supplied QueryRunner with
QueryToolChest.createResultComparator(Query) and QueryToolChest.createMergeFn(Query)} supplied by this
toolchest.mergeResults in class QueryToolChest<RowsAndColumns,WindowOperatorQuery>runner - A QueryRunner that provides a series of ResultType objects in time order (ascending or descending)public QueryMetrics<? super WindowOperatorQuery> makeMetrics(WindowOperatorQuery query)
QueryToolChestQueryMetrics object that is used to generate metrics for this specific query type. This exists
to allow for query-specific dimensions and metrics. That is, the ToolChest is expected to set some
meaningful dimensions for metrics given this query type. Examples might be the topN threshold for
a TopN query or the number of dimensions included for a groupBy query.
QueryToolChests for query types in core (druid-processing) and public extensions (belonging to the Druid source
tree) should use delegate this method to GenericQueryMetricsFactory.makeMetrics(Query) on an injected
instance of GenericQueryMetricsFactory, as long as they don't need to emit custom dimensions and/or
metrics.
If some custom dimensions and/or metrics should be emitted for a query type, a plan described in
"Making subinterfaces of QueryMetrics" section in QueryMetrics's class-level Javadocs should be followed.
One way or another, this method should ensure that QueryMetrics.query(Query) is called with the given
query passed on the created QueryMetrics object before returning.
makeMetrics in class QueryToolChest<RowsAndColumns,WindowOperatorQuery>query - The query that is being processedpublic com.google.common.base.Function<RowsAndColumns,RowsAndColumns> makePreComputeManipulatorFn(WindowOperatorQuery query, MetricManipulationFn fn)
QueryToolChestThis exists because the QueryToolChest is the only thing that understands the internal serialization format of ResultType, so it's primary responsibility is to "decompose" that structure and apply the given function to all metrics.
This function is called very early in the processing pipeline on the Broker.
makePreComputeManipulatorFn in class QueryToolChest<RowsAndColumns,WindowOperatorQuery>query - The Query that is currently being processedfn - The function that should be applied to all metrics in the resultspublic com.fasterxml.jackson.core.type.TypeReference<RowsAndColumns> getResultTypeReference()
QueryToolChestgetResultTypeReference in class QueryToolChest<RowsAndColumns,WindowOperatorQuery>public RowSignature resultArraySignature(WindowOperatorQuery query)
QueryToolChestRowSignature for the arrays returned by QueryToolChest.resultsAsArrays(QueryType, org.apache.druid.java.util.common.guava.Sequence<ResultType>). The returned signature will
be the same length as each array returned by QueryToolChest.resultsAsArrays(QueryType, org.apache.druid.java.util.common.guava.Sequence<ResultType>).resultArraySignature in class QueryToolChest<RowsAndColumns,WindowOperatorQuery>query - same query passed to QueryToolChest.resultsAsArrays(QueryType, org.apache.druid.java.util.common.guava.Sequence<ResultType>)public Sequence<Object[]> resultsAsArrays(WindowOperatorQuery query, Sequence<RowsAndColumns> resultSequence)
QueryToolChestQueryToolChest.resultArraySignature(QueryType). This functionality is useful because it allows higher-level processors to operate on
the results of any query in a consistent way. This is useful for the SQL layer and for any algorithm that might
operate on the results of an inner query.
Not all query types support this method. They will throw UnsupportedOperationException, and they cannot
be used by the SQL layer or by generic higher-level algorithms.
Some query types return less information after translating their results into arrays, especially in situations
where there is no clear way to translate fully rich results into flat arrays. For example, the scan query does not
include the segmentId in its array-based results, because it could potentially conflict with a 'segmentId' field
in the actual datasource being scanned.
It is possible that there will be multiple arrays returned for a single result object. For example, in the topN
query, each TopNResultValue will generate a separate array for each of its
values.
By convention, the array form should include the __time column, if present, as a long (milliseconds since epoch).resultsAsArrays in class QueryToolChest<RowsAndColumns,WindowOperatorQuery>resultSequence - results of the form returned by QueryToolChest.mergeResults(org.apache.druid.query.QueryRunner<ResultType>)Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.