Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
scan-node.h
Go to the documentation of this file.
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 
15 
16 #ifndef IMPALA_EXEC_SCAN_NODE_H_
17 #define IMPALA_EXEC_SCAN_NODE_H_
18 
19 #include <string>
20 #include "exec/exec-node.h"
21 #include "util/runtime-profile.h"
22 #include "gen-cpp/ImpalaInternalService_types.h"
23 
24 namespace impala {
25 
26 class TScanRange;
27 
29 //
33 //
39 //
43 //
47 //
49 //
54 //
58 //
61 //
65 //
67 //
69 //
71 //
76 //
77 class ScanNode : public ExecNode {
78  public:
79  ScanNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl& descs)
80  : ExecNode(pool, tnode, descs),
81  scan_range_params_(NULL),
82  active_scanner_thread_counter_(TUnit::UNIT, 0),
83  active_hdfs_read_thread_counter_(TUnit::UNIT, 0) {}
84 
85  virtual Status Prepare(RuntimeState* state);
86 
89  void SetScanRanges(const std::vector<TScanRangeParams>& scan_range_params) {
90  scan_range_params_ = &scan_range_params;
91  }
92 
93  virtual bool IsScanNode() const { return true; }
94 
100  }
103  }
106  }
109  }
112  }
115  }
118  }
119 
121  static const std::string BYTES_READ_COUNTER;
122  static const std::string ROWS_READ_COUNTER;
123  static const std::string TOTAL_HDFS_READ_TIMER;
124  static const std::string TOTAL_HBASE_READ_TIMER;
125  static const std::string TOTAL_THROUGHPUT_COUNTER;
126  static const std::string PER_READ_THREAD_THROUGHPUT_COUNTER;
127  static const std::string NUM_DISKS_ACCESSED_COUNTER;
128  static const std::string MATERIALIZE_TUPLE_TIMER;
129  static const std::string SCAN_RANGES_COMPLETE_COUNTER;
130  static const std::string SCANNER_THREAD_COUNTERS_PREFIX;
131  static const std::string SCANNER_THREAD_TOTAL_WALLCLOCK_TIME;
132  static const std::string AVERAGE_SCANNER_THREAD_CONCURRENCY;
133  static const std::string AVERAGE_HDFS_READ_THREAD_CONCURRENCY;
134  static const std::string NUM_SCANNER_THREADS_STARTED;
135 
136  protected:
138  const std::vector<TScanRangeParams>* scan_range_params_;
139 
140  RuntimeProfile::Counter* bytes_read_counter_; // # bytes read from the scanner
151  RuntimeProfile::Counter* materialize_tuple_timer_; // time writing tuple slots
155 
158 
162 
165 
169 
171 
174  std::vector<RuntimeProfile::Counter*> hdfs_read_thread_concurrency_bucket_;
175 };
176 
177 }
178 
179 #endif
RuntimeProfile::ThreadCounters * scanner_thread_counters() const
Definition: scan-node.h:110
static const std::string NUM_SCANNER_THREADS_STARTED
Definition: scan-node.h:134
RuntimeProfile::Counter * per_read_thread_throughput_counter_
Per thread read throughput [bytes/sec].
Definition: scan-node.h:149
virtual Status Prepare(RuntimeState *state)
Definition: scan-node.cc:44
A set of counters that measure thread info, such as total time, user time, sys time.
RuntimeProfile::Counter * average_scanner_thread_concurrency() const
Definition: scan-node.h:116
RuntimeProfile::Counter * scan_ranges_complete_counter_
Definition: scan-node.h:152
static const std::string TOTAL_THROUGHPUT_COUNTER
Definition: scan-node.h:125
static const std::string AVERAGE_SCANNER_THREAD_CONCURRENCY
Definition: scan-node.h:132
RuntimeProfile::Counter * scan_ranges_complete_counter() const
Definition: scan-node.h:107
RuntimeProfile::Counter * num_scanner_threads_started_counter_
Definition: scan-node.h:170
RuntimeProfile::Counter * read_timer_
Definition: scan-node.h:145
static const std::string NUM_DISKS_ACCESSED_COUNTER
Definition: scan-node.h:127
RuntimeProfile::Counter * rows_read_counter() const
Definition: scan-node.h:96
static const std::string MATERIALIZE_TUPLE_TIMER
Definition: scan-node.h:128
static const std::string TOTAL_HBASE_READ_TIMER
Definition: scan-node.h:124
RuntimeProfile::Counter * bytes_read_counter_
Definition: scan-node.h:140
static const std::string PER_READ_THREAD_THROUGHPUT_COUNTER
Definition: scan-node.h:126
RuntimeProfile::Counter * materialize_tuple_timer_
Definition: scan-node.h:151
ScanNode(ObjectPool *pool, const TPlanNode &tnode, const DescriptorTbl &descs)
Definition: scan-node.h:79
static const std::string SCAN_RANGES_COMPLETE_COUNTER
Definition: scan-node.h:129
RuntimeProfile::Counter * average_hdfs_read_thread_concurrency_
Definition: scan-node.h:168
std::vector< RuntimeProfile::Counter * > hdfs_read_thread_concurrency_bucket_
Definition: scan-node.h:174
static const std::string SCANNER_THREAD_COUNTERS_PREFIX
Definition: scan-node.h:130
RuntimeProfile::Counter * num_disks_accessed_counter_
Definition: scan-node.h:150
static const std::string AVERAGE_HDFS_READ_THREAD_CONCURRENCY
Definition: scan-node.h:133
RuntimeProfile::Counter * rows_read_counter_
rows/tuples read from the scanner (including those discarded by EvalConjucts())
Definition: scan-node.h:144
static const std::string ROWS_READ_COUNTER
Definition: scan-node.h:122
RuntimeProfile::Counter active_scanner_thread_counter_
The number of active scanner threads that are not blocked by IO.
Definition: scan-node.h:157
ObjectPool pool
RuntimeProfile::Counter * per_read_thread_throughput_counter() const
Definition: scan-node.h:101
RuntimeProfile::Counter * bytes_read_counter() const
Definition: scan-node.h:95
void SetScanRanges(const std::vector< TScanRangeParams > &scan_range_params)
Definition: scan-node.h:89
Abstract base class of all scan nodes; introduces SetScanRange().
Definition: scan-node.h:77
RuntimeProfile::Counter * total_throughput_counter_
Wall based aggregate read throughput [bytes/sec].
Definition: scan-node.h:147
RuntimeProfile::ThreadCounters * scanner_thread_counters_
Aggregated scanner thread counters.
Definition: scan-node.h:154
RuntimeProfile::Counter * total_throughput_counter() const
Definition: scan-node.h:98
static const std::string TOTAL_HDFS_READ_TIMER
Definition: scan-node.h:123
RuntimeProfile::Counter & active_scanner_thread_counter()
Definition: scan-node.h:113
virtual bool IsScanNode() const
Definition: scan-node.h:93
RuntimeProfile::Counter * average_scanner_thread_concurrency_
Definition: scan-node.h:161
RuntimeProfile::TimeSeriesCounter * bytes_read_timeseries_counter_
Time series of the bytes_read_counter_.
Definition: scan-node.h:142
const std::vector< TScanRangeParams > * scan_range_params_
The scan ranges this scan node is responsible for. Not owned.
Definition: scan-node.h:138
static const std::string SCANNER_THREAD_TOTAL_WALLCLOCK_TIME
Definition: scan-node.h:131
RuntimeProfile::Counter active_hdfs_read_thread_counter_
The number of active hdfs reading threads reading for this node.
Definition: scan-node.h:164
RuntimeProfile::Counter * read_timer() const
Definition: scan-node.h:97
static const std::string BYTES_READ_COUNTER
names of ScanNode common counters
Definition: scan-node.h:121
RuntimeProfile::Counter * materialize_tuple_timer() const
Definition: scan-node.h:104