21 #include "gen-cpp/PlanNodes_types.h"
30 tuple_id_(tnode.union_node.tuple_id),
31 const_result_expr_idx_(0),
33 child_row_batch_(NULL),
40 DCHECK(tnode.__isset.union_node);
42 const vector<vector<TExpr> >& const_texpr_lists = tnode.union_node.const_expr_lists;
43 for (
int i = 0; i < const_texpr_lists.size(); ++i) {
44 vector<ExprContext*> ctxs;
49 const vector<vector<TExpr> >& result_texpr_lists = tnode.union_node.result_expr_lists;
50 for (
int i = 0; i < result_texpr_lists.size(); ++i) {
51 vector<ExprContext*> ctxs;
182 DCHECK(
false) <<
"NYI";
220 int row_idx = row_batch->
AddRow();
227 for (
int i = 0; i < ctxs.size(); ++i) {
238 char* new_tuple =
reinterpret_cast<char*
>(*tuple);
240 *tuple =
reinterpret_cast<Tuple*
>(new_tuple);
int child_idx_
Index of current child.
const TupleDescriptor * tuple_desc_
Descriptor for tuples this union node constructs.
std::vector< std::vector< ExprContext * > > const_result_expr_ctx_lists_
Const exprs materialized by this node. These exprs don't refer to any children.
virtual Status Open(RuntimeState *state)
int64_t num_rows_returned_
MemTracker * mem_tracker()
virtual Status GetNext(RuntimeState *state, RowBatch *row_batch, bool *eos)
bool EvalAndMaterializeExprs(const std::vector< ExprContext * > &ctxs, bool const_exprs, Tuple **tuple, RowBatch *row_batch)
boost::scoped_ptr< RuntimeProfile > runtime_profile_
static Status Open(const std::vector< ExprContext * > &ctxs, RuntimeState *state)
Convenience function for opening multiple expr trees.
A tuple with 0 materialised slots is represented as NULL.
#define RETURN_IF_ERROR(stmt)
some generally useful macros
virtual Status Init(const TPlanNode &tnode)
TupleRow * GetRow(int row_idx)
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.
const std::vector< SlotDescriptor * > & slots() const
int child_row_idx_
Index of current row in child_row_batch_.
int const_result_expr_idx_
Index of current const result expr list.
const RowDescriptor & row_desc() const
static Tuple * Create(int size, MemPool *pool)
initialize individual tuple with data residing in mem pool
UnionNode(ObjectPool *pool, const TPlanNode &tnode, const DescriptorTbl &descs)
Status ExecDebugAction(TExecNodePhase::type phase, RuntimeState *state)
TupleDescriptor * GetTupleDescriptor(TupleId id) const
const std::vector< ExprContext * > & conjunct_ctxs() const
static void Close(const std::vector< ExprContext * > &ctxs, RuntimeState *state)
Convenience function for closing multiple expr trees.
virtual Status Reset(RuntimeState *state)
MemTracker * expr_mem_tracker()
std::vector< SlotDescriptor * > materialized_slots_
those tuple_desc_->slots() which are materialized, in the same order
virtual Status Init(const TPlanNode &tnode)
#define RETURN_IF_CANCELLED(state)
virtual Status Prepare(RuntimeState *state)
static void Write(const void *value, Tuple *tuple, const SlotDescriptor *slot_desc, MemPool *pool)
void AddExprCtxsToFree(const std::vector< ExprContext * > &ctxs)
virtual Status QueryMaintenance(RuntimeState *state)
const DescriptorTbl & desc_tbl() const
virtual void Close(RuntimeState *state)
std::vector< ExecNode * > children_
#define COUNTER_SET(c, v)
virtual Status Prepare(RuntimeState *state)
MemPool * tuple_data_pool()
RuntimeProfile::Counter * rows_returned_counter_
Status OpenCurrentChild(RuntimeState *state)
void SetTuple(int tuple_idx, Tuple *tuple)
bool child_eos_
Saved from the last to GetNext() on the current child.
static Status CreateExprTrees(ObjectPool *pool, const std::vector< TExpr > &texprs, std::vector< ExprContext * > *ctxs)
int MaxTupleBufferSize()
Computes the maximum size needed to store tuple data for this row batch.
static bool EvalConjuncts(ExprContext *const *ctxs, int num_ctxs, TupleRow *row)
bool is_materialized() const
static Status Prepare(const std::vector< ExprContext * > &ctxs, RuntimeState *state, const RowDescriptor &row_desc, MemTracker *tracker)
virtual Status Open(RuntimeState *state)
int tuple_id_
Tuple id resolved in Prepare() to set tuple_desc_;.
std::vector< ExprContext * > conjunct_ctxs_
virtual void Close(RuntimeState *state)
const TPlanFragmentInstanceCtx & fragment_ctx() const
boost::scoped_ptr< RowBatch > child_row_batch_
static const int INVALID_ROW_INDEX