Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
exchange-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_EXCHANGE_NODE_H
17 #define IMPALA_EXEC_EXCHANGE_NODE_H
18 
19 #include <boost/scoped_ptr.hpp>
20 #include "exec/exec-node.h"
21 #include "exec/sort-exec-exprs.h"
22 
23 namespace impala {
24 
25 class RowBatch;
26 class DataStreamRecvr;
27 
39 class ExchangeNode : public ExecNode {
40  public:
41  ExchangeNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl& descs);
42 
43  virtual Status Init(const TPlanNode& tnode);
44  virtual Status Prepare(RuntimeState* state);
46  virtual Status Open(RuntimeState* state);
47  virtual Status GetNext(RuntimeState* state, RowBatch* row_batch, bool* eos);
48  virtual Status Reset(RuntimeState* state);
49  virtual void Close(RuntimeState* state);
50 
53  void set_num_senders(int num_senders) { num_senders_ = num_senders; }
54 
55  protected:
56  virtual void DebugString(int indentation_level, std::stringstream* out) const;
57 
58  private:
61  Status GetNextMerging(RuntimeState* state, RowBatch* output_batch, bool* eos);
62 
66 
67  int num_senders_; // needed for stream_recvr_ construction
68 
72  boost::shared_ptr<DataStreamRecvr> stream_recvr_;
73 
76 
81 
86 
89 
93 
96  std::vector<bool> is_asc_order_;
97  std::vector<bool> nulls_first_;
98 
100  int64_t offset_;
101 
104 };
105 
106 };
107 
108 #endif
109 
boost::shared_ptr< DataStreamRecvr > stream_recvr_
Definition: exchange-node.h:72
void set_num_senders(int num_senders)
Definition: exchange-node.h:53
virtual Status Open(RuntimeState *state)
Blocks until the first batch is available for consumption via GetNext().
int64_t num_rows_skipped_
Number of rows skipped so far.
virtual Status Init(const TPlanNode &tnode)
virtual Status Prepare(RuntimeState *state)
std::vector< bool > is_asc_order_
Definition: exchange-node.h:96
RowDescriptor input_row_desc_
our input rows are a prefix of the rows we produce
Definition: exchange-node.h:75
std::string DebugString() const
Returns a string representation in DFS order of the plan rooted at this.
Definition: exec-node.cc:345
SortExecExprs sort_exec_exprs_
Sort expressions and parameters passed to the merging receiver..
Definition: exchange-node.h:95
Status FillInputRowBatch(RuntimeState *state)
ExchangeNode(ObjectPool *pool, const TPlanNode &tnode, const DescriptorTbl &descs)
virtual Status Reset(RuntimeState *state)
ObjectPool pool
RuntimeProfile::Counter * convert_row_batch_timer_
time spent reconstructing received rows
Definition: exchange-node.h:88
Status GetNextMerging(RuntimeState *state, RowBatch *output_batch, bool *eos)
RowBatch * input_batch_
Definition: exchange-node.h:80
int64_t offset_
Offset specifying number of rows to skip.
std::vector< bool > nulls_first_
Definition: exchange-node.h:97
virtual Status GetNext(RuntimeState *state, RowBatch *row_batch, bool *eos)
virtual void Close(RuntimeState *state)