Package org.apache.druid.query.context
Class ResponseContext.Keys
java.lang.Object
org.apache.druid.query.context.ResponseContext.Keys
- Enclosing class:
ResponseContext
Global registry of response context keys. Also defines the standard keys
associated with objects in the context.
If it's necessary to add new keys in the context then they should be listed in a separate class:
invalid input: '{@code
public class SomeClass
{
static final Key EXTENSION_KEY_1 = new StringKey(
"extension_key_1", Visibility.HEADER_AND_TRAILER, true),
static final Key EXTENSION_KEY_2 = new CounterKey(
"extension_key_2", Visibility.None);
static {
Keys.instance().registerKeys(new Key[] {
EXTENSION_KEY_1,
EXTENSION_KEY_2
});
}
}</pre>
Make sure all extension keys are added with the {@link #registerKey(Key)} or
{@link #registerKeys(Key[])} methods.
<p>
Create custom keys in one of two ways. As shown above, predefined key types
exist for common values. Custom values can be created as shown in the code
for this class.'-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ResponseContext.KeyThe total CPU time for threads related to Sequence processing of the query.static final ResponseContext.KeyEntity tag.static final ResponseContext.KeysOne and only global list of keys.static final ResponseContext.KeyLists missing segments.static final ResponseContext.KeyThe number of rows scanned byScanQueryEngine.static final ResponseContext.KeyQuery fail time (current time + timeout).static final ResponseContext.KeyQuery total bytes gathered.static final ResponseContext.KeyMap of most relevant query ID to remaining number of responses from query nodes.static final ResponseContext.KeyThis variable indicates when a running query should be expired, and is effective only when 'timeout' of queryContext has a positive value.static final ResponseContext.KeyIndicates if aResponseContextwas truncated during serialization.static final ResponseContext.KeyLists intervals for which NO segment is present.static final ResponseContext.KeyIndicates if the number of uncovered intervals exceeded the limit (true/false). -
Method Summary
Modifier and TypeMethodDescriptionReturns a registered key associated with the given name, ornullif the key is not registered.static ResponseContext.Keysinstance()Returns the single, global key registry for this server.Returns a registered key associated with the name .voidPrimary way of registering context keys.voidregisterKeys(ResponseContext.Key[] keys) Register a group of keys.
-
Field Details
-
UNCOVERED_INTERVALS
Lists intervals for which NO segment is present. -
UNCOVERED_INTERVALS_OVERFLOWED
Indicates if the number of uncovered intervals exceeded the limit (true/false). -
REMAINING_RESPONSES_FROM_QUERY_SERVERS
Map of most relevant query ID to remaining number of responses from query nodes. The value is initialized inCachingClusteredClientwhen it initializes the connection to the query nodes, and is updated whenever they respond (@code DirectDruidClient).RetryQueryRunneruses this value to check if theMISSING_SEGMENTSis valid.Currently, the broker doesn't run subqueries in parallel, the remaining number of responses will be updated one by one per subquery. However, since it can be parallelized to run subqueries simultaneously, we store them in a ConcurrentHashMap.
- See Also:
-
MISSING_SEGMENTS
Lists missing segments. -
ETAG
Entity tag. A part of HTTP cache validation mechanism. Is being removed from the context before sending and used as a separate HTTP header. -
QUERY_TOTAL_BYTES_GATHERED
Query total bytes gathered. -
QUERY_FAIL_DEADLINE_MILLIS
Query fail time (current time + timeout). -
TIMEOUT_AT
This variable indicates when a running query should be expired, and is effective only when 'timeout' of queryContext has a positive value. -
NUM_SCANNED_ROWS
The number of rows scanned byScanQueryEngine.Named "count" for backwards compatibility with older data servers that still send this, even though it's now marked as internal.
-
CPU_CONSUMED_NANOS
The total CPU time for threads related to Sequence processing of the query. Resulting value on a Broker is a sum of downstream values from historicals / realtime nodes. For additional information seeCPUTimeMetricQueryRunner -
TRUNCATED
Indicates if aResponseContextwas truncated during serialization. -
INSTANCE
One and only global list of keys. This is a semi-constant: it is mutable at start-up time, but then is not thread-safe, and must remain unchanged for the duration of the server run.
-
-
Method Details
-
instance
Returns the single, global key registry for this server. -
registerKey
Primary way of registering context keys.- Throws:
IllegalArgumentException- if the key has already been registered.
-
registerKeys
Register a group of keys. -
keyOf
Returns a registered key associated with the name .- Throws:
IllegalStateException- if a corresponding key has not been registered.
-
find
Returns a registered key associated with the given name, ornullif the key is not registered. This form is for testing and for deserialization when the existence of the key is suspect.
-