1// Copyright 2012 Cloudera Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15namespace cpp impala
16namespace java com.cloudera.impala.thrift
17
18include "Status.thrift"
19include "Types.thrift"
20
21enum TExecState {
22  REGISTERED = 0,
23  PLANNING = 1,
24  QUEUED = 2,
25  RUNNING = 3,
26  FINISHED = 4,
27
28  CANCELLED = 5,
29  FAILED = 6,
30}
31
32// Execution stats for a single plan node.
33struct TExecStats {
34  // The wall clock time spent on the "main" thread. This is the user perceived
35  // latency. This value indicates the current bottleneck.
36  // Note: anywhere we have a queue between operators, this time can fluctuate
37  // significantly without the overall query time changing much (i.e. the bottleneck
38  // moved to another operator). This is unavoidable though.
39  1: optional i64 latency_ns
40
41  // Total CPU time spent across all threads. For operators that have an async
42  // component (e.g. multi-threaded) this will be >= latency_ns.
43  2: optional i64 cpu_time_ns
44
45  // Number of rows returned.
46  3: optional i64 cardinality
47
48  // Peak memory used (in bytes).
49  4: optional i64 memory_used
50}
51
52// Summary for a single plan node. This includes labels for how to display the
53// node as well as per instance stats.
54struct TPlanNodeExecSummary {
55  1: required Types.TPlanNodeId node_id
56  2: required i32 fragment_id
57  3: required string label
58  4: optional string label_detail
59  5: required i32 num_children
60
61  // Estimated stats generated by the planner
62  6: optional TExecStats estimated_stats
63
64  // One entry for each BE executing this plan node.
65  7: optional list<TExecStats> exec_stats
66
67  // One entry for each BE executing this plan node. True if this plan node is still
68  // running.
69  8: optional list<bool> is_active
70
71  // If true, this plan node is an exchange node that is the receiver of a broadcast.
72  9: optional bool is_broadcast
73}
74
75// Progress counters for an in-flight query.
76struct TExecProgress {
77  1: optional i64 total_scan_ranges
78  2: optional i64 num_completed_scan_ranges
79}
80
81// Execution summary of an entire query.
82struct TExecSummary {
83  // State of the query.
84  1: required TExecState state
85
86  // Contains the error if state is FAILED.
87  2: optional Status.TStatus status
88
89  // Flattened execution summary of the plan tree.
90  3: optional list<TPlanNodeExecSummary> nodes
91
92  // For each exch node in 'nodes', contains the index to the root node of the sending
93  // fragment for this exch. Both the key and value are indices into 'nodes'.
94  4: optional map<i32, i32> exch_to_sender_map
95
96  // List of errors that were encountered during execution. This can be non-empty
97  // even if status is okay, in which case it contains errors that impala skipped
98  // over.
99  5: optional list<string> error_logs
100
101  // Optional record indicating the query progress
102  6: optional TExecProgress progress
103}
104