Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
union-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_UNION_NODE_H_
17 #define IMPALA_EXEC_UNION_NODE_H_
18 
19 #include <boost/scoped_ptr.hpp>
20 
21 #include "exec/exec-node.h"
22 #include "exprs/expr.h"
23 #include "runtime/mem-pool.h"
24 #include <boost/scoped_ptr.hpp>
25 
26 namespace impala {
27 
28 class Tuple;
29 class TupleRow;
30 
35 class UnionNode : public ExecNode {
36  public:
37  UnionNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl& descs);
38 
39  virtual Status Init(const TPlanNode& tnode);
40  virtual Status Prepare(RuntimeState* state);
41  virtual Status Open(RuntimeState* state);
42  virtual Status GetNext(RuntimeState* state, RowBatch* row_batch, bool* eos);
43  virtual Status Reset(RuntimeState* state);
44  virtual void Close(RuntimeState* state);
45 
46  private:
48  int tuple_id_;
49 
52 
54  std::vector<SlotDescriptor*> materialized_slots_;
55 
57  std::vector<std::vector<ExprContext*> > const_result_expr_ctx_lists_;
58 
61 
63  std::vector<std::vector<ExprContext*> > result_expr_ctx_lists_;
64 
67 
70  boost::scoped_ptr<RowBatch> child_row_batch_;
71 
73  bool child_eos_;
74 
77 
81 
90  bool EvalAndMaterializeExprs( const std::vector<ExprContext*>& ctxs,
91  bool const_exprs, Tuple** tuple, RowBatch* row_batch);
92 };
93 
94 }
95 
96 #endif
int child_idx_
Index of current child.
Definition: union-node.h:66
const TupleDescriptor * tuple_desc_
Descriptor for tuples this union node constructs.
Definition: union-node.h:51
std::vector< std::vector< ExprContext * > > const_result_expr_ctx_lists_
Const exprs materialized by this node. These exprs don't refer to any children.
Definition: union-node.h:57
virtual Status Open(RuntimeState *state)
Definition: union-node.cc:88
virtual Status GetNext(RuntimeState *state, RowBatch *row_batch, bool *eos)
Definition: union-node.cc:119
bool EvalAndMaterializeExprs(const std::vector< ExprContext * > &ctxs, bool const_exprs, Tuple **tuple, RowBatch *row_batch)
Definition: union-node.cc:198
A tuple with 0 materialised slots is represented as NULL.
Definition: tuple.h:48
std::vector< std::vector< ExprContext * > > result_expr_ctx_lists_
Exprs materialized by this node. The i-th result expr list refers to the i-th child.
Definition: union-node.h:63
int child_row_idx_
Index of current row in child_row_batch_.
Definition: union-node.h:76
int const_result_expr_idx_
Index of current const result expr list.
Definition: union-node.h:60
UnionNode(ObjectPool *pool, const TPlanNode &tnode, const DescriptorTbl &descs)
Definition: union-node.cc:27
virtual Status Reset(RuntimeState *state)
Definition: union-node.cc:181
std::vector< SlotDescriptor * > materialized_slots_
those tuple_desc_->slots() which are materialized, in the same order
Definition: union-node.h:54
virtual Status Init(const TPlanNode &tnode)
Definition: union-node.cc:38
ObjectPool pool
virtual void Close(RuntimeState *state)
Definition: union-node.cc:186
virtual Status Prepare(RuntimeState *state)
Definition: union-node.cc:58
Status OpenCurrentChild(RuntimeState *state)
Definition: union-node.cc:107
bool child_eos_
Saved from the last to GetNext() on the current child.
Definition: union-node.h:73
int tuple_id_
Tuple id resolved in Prepare() to set tuple_desc_;.
Definition: union-node.h:48
boost::scoped_ptr< RowBatch > child_row_batch_
Definition: union-node.h:70