Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::AggregationNode Class Reference

#include <aggregation-node.h>

Inheritance diagram for impala::AggregationNode:
Collaboration diagram for impala::AggregationNode:

Public Member Functions

 AggregationNode (ObjectPool *pool, const TPlanNode &tnode, const DescriptorTbl &descs)
 
virtual Status Init (const TPlanNode &tnode)
 
virtual Status Prepare (RuntimeState *state)
 
virtual Status Open (RuntimeState *state)
 
virtual Status GetNext (RuntimeState *state, RowBatch *row_batch, bool *eos)
 
virtual Status Reset (RuntimeState *state)
 
virtual void Close (RuntimeState *state)
 
void CollectNodes (TPlanNodeType::type node_type, std::vector< ExecNode * > *nodes)
 
void CollectScanNodes (std::vector< ExecNode * > *nodes)
 Collect all scan node types. More...
 
std::string DebugString () const
 Returns a string representation in DFS order of the plan rooted at this. More...
 
const std::vector< ExprContext * > & conjunct_ctxs () const
 
int id () const
 
TPlanNodeType::type type () const
 
const RowDescriptorrow_desc () const
 
int64_t rows_returned () const
 
int64_t limit () const
 
bool ReachedLimit ()
 
RuntimeProfileruntime_profile ()
 
MemTrackermem_tracker ()
 
MemTrackerexpr_mem_tracker ()
 

Static Public Member Functions

static Status CreateTree (ObjectPool *pool, const TPlan &plan, const DescriptorTbl &descs, ExecNode **root)
 
static void SetDebugOptions (int node_id, TExecNodePhase::type phase, TDebugAction::type action, ExecNode *tree)
 Set debug action for node with given id in 'tree'. More...
 
static bool EvalConjuncts (ExprContext *const *ctxs, int num_ctxs, TupleRow *row)
 
static llvm::Function * CodegenEvalConjuncts (RuntimeState *state, const std::vector< ExprContext * > &conjunct_ctxs, const char *name="EvalConjuncts")
 
static int GetNodeIdFromProfile (RuntimeProfile *p)
 Extract node id from p->name(). More...
 

Static Public Attributes

static const char * LLVM_CLASS_NAME = "class.impala::AggregationNode"
 
static const std::string ROW_THROUGHPUT_COUNTER = "RowsReturnedRate"
 Names of counters shared by all exec nodes. More...
 

Protected Member Functions

virtual void DebugString (int indentation_level, std::stringstream *out) const
 
ExecNodechild (int i)
 
bool is_closed ()
 
virtual bool IsScanNode () const
 
void InitRuntimeProfile (const std::string &name)
 
Status ExecDebugAction (TExecNodePhase::type phase, RuntimeState *state)
 
void AddRuntimeExecOption (const std::string &option)
 Appends option to 'runtime_exec_options_'. More...
 
virtual Status QueryMaintenance (RuntimeState *state)
 
void AddExprCtxToFree (ExprContext *ctx)
 
void AddExprCtxsToFree (const std::vector< ExprContext * > &ctxs)
 
void AddExprCtxsToFree (const SortExecExprs &sort_exec_exprs)
 

Static Protected Member Functions

static Status CreateNode (ObjectPool *pool, const TPlanNode &tnode, const DescriptorTbl &descs, ExecNode **node)
 Create a single exec node derived from thrift node; place exec node in 'pool'. More...
 
static Status CreateTreeHelper (ObjectPool *pool, const std::vector< TPlanNode > &tnodes, const DescriptorTbl &descs, ExecNode *parent, int *node_idx, ExecNode **root)
 

Protected Attributes

int id_
 
TPlanNodeType::type type_
 
ObjectPoolpool_
 
std::vector< ExprContext * > conjunct_ctxs_
 
std::vector< ExecNode * > children_
 
RowDescriptor row_descriptor_
 
TExecNodePhase::type debug_phase_
 
TDebugAction::type debug_action_
 
int64_t limit_
 
int64_t num_rows_returned_
 
boost::scoped_ptr< RuntimeProfileruntime_profile_
 
RuntimeProfile::Counterrows_returned_counter_
 
RuntimeProfile::Counterrows_returned_rate_
 
boost::scoped_ptr< MemTrackermem_tracker_
 Account for peak memory used by this node. More...
 
boost::scoped_ptr< MemTrackerexpr_mem_tracker_
 MemTracker that should be used for ExprContexts. More...
 
boost::mutex exec_options_lock_
 
std::string runtime_exec_options_
 

Private Types

typedef void(* ProcessRowBatchFn )(AggregationNode *, RowBatch *)
 

Private Member Functions

TupleConstructIntermediateTuple ()
 
void UpdateTuple (Tuple *tuple, TupleRow *row)
 
TupleFinalizeTuple (Tuple *tuple, MemPool *pool)
 
void ProcessRowBatchNoGrouping (RowBatch *batch)
 Do the aggregation for all tuple rows in the batch. More...
 
void ProcessRowBatchWithGrouping (RowBatch *batch)
 
llvm::Function * CodegenProcessRowBatch (RuntimeState *state, llvm::Function *update_tuple_fn)
 
llvm::Function * CodegenUpdateSlot (RuntimeState *state, AggFnEvaluator *evaluator, SlotDescriptor *slot_desc)
 
llvm::Function * CodegenUpdateTuple (RuntimeState *state)
 Codegen UpdateTuple(). Returns NULL if codegen is unsuccessful. More...
 

Private Attributes

boost::scoped_ptr< OldHashTablehash_tbl_
 
OldHashTable::Iterator output_iterator_
 
std::vector< AggFnEvaluator * > aggregate_evaluators_
 
std::vector
< impala_udf::FunctionContext * > 
agg_fn_ctxs_
 FunctionContext for each agg fn and backing pool. More...
 
boost::scoped_ptr< MemPoolagg_fn_pool_
 
std::vector< ExprContext * > probe_expr_ctxs_
 Exprs used to evaluate input rows. More...
 
std::vector< ExprContext * > build_expr_ctxs_
 
TupleId intermediate_tuple_id_
 Tuple into which Update()/Merge()/Serialize() results are stored. More...
 
TupleDescriptorintermediate_tuple_desc_
 
TupleId output_tuple_id_
 
TupleDescriptoroutput_tuple_desc_
 
Tuplesingleton_intermediate_tuple_
 
boost::scoped_ptr< MemPooltuple_pool_
 
llvm::Function * codegen_process_row_batch_fn_
 IR for process row batch. NULL if codegen is disabled. More...
 
ProcessRowBatchFn process_row_batch_fn_
 Jitted ProcessRowBatch function pointer. Null if codegen is disabled. More...
 
bool needs_finalize_
 
RuntimeProfile::Counterbuild_timer_
 Time spent processing the child rows. More...
 
RuntimeProfile::Counterget_results_timer_
 Time spent returning the aggregated rows. More...
 
RuntimeProfile::Counterhash_table_buckets_counter_
 Num buckets in hash table. More...
 
RuntimeProfile::Counterhash_table_load_factor_counter_
 Load factor in hash table. More...
 

Detailed Description

Node for in-memory hash aggregation. The node creates a hash set of aggregation intermediate tuples, which contain slots for all grouping and aggregation exprs (the grouping slots precede the aggregation expr slots in the output tuple descriptor). TODO: codegen cross-compiled UDAs and get rid of handcrafted IR. TODO: investigate high compile time for wide tables

Definition at line 50 of file aggregation-node.h.

Member Typedef Documentation

typedef void(* impala::AggregationNode::ProcessRowBatchFn)(AggregationNode *, RowBatch *)
private

Definition at line 100 of file aggregation-node.h.

Constructor & Destructor Documentation

impala::AggregationNode::AggregationNode ( ObjectPool pool,
const TPlanNode &  tnode,
const DescriptorTbl descs 
)

Definition at line 56 of file aggregation-node.cc.

Member Function Documentation

void impala::ExecNode::AddExprCtxsToFree ( const SortExecExprs sort_exec_exprs)
protectedinherited
void impala::ExecNode::AddExprCtxToFree ( ExprContext ctx)
inlineprotectedinherited

Add an ExprContext to have its local allocations freed by QueryMaintenance(). Exprs that are evaluated in the main execution thread should be added. Exprs evaluated in a separate thread are generally not safe to add, since a local allocation may be freed while it's being used. Rather than using this mechanism, threads should call FreeLocalAllocations() on local ExprContexts periodically.

Definition at line 276 of file exec-node.h.

References impala::ExecNode::expr_ctxs_to_free_.

Referenced by impala::AnalyticEvalNode::Prepare().

ExecNode* impala::ExecNode::child ( int  i)
inlineprotectedinherited

Definition at line 241 of file exec-node.h.

References impala::ExecNode::children_.

Referenced by impala::CrossJoinNode::BuildListDebugString(), impala::BlockingJoinNode::BuildSideThread(), impala::HashJoinNode::CodegenCreateOutputRow(), impala::PartitionedHashJoinNode::CodegenCreateOutputRow(), impala::CrossJoinNode::ConstructBuildSide(), impala::HashJoinNode::ConstructBuildSide(), impala::PartitionedHashJoinNode::ConstructBuildSide(), impala::BlockingJoinNode::GetLeftChildRowString(), impala::SelectNode::GetNext(), impala::UnionNode::GetNext(), impala::CrossJoinNode::GetNext(), impala::HashJoinNode::GetNext(), impala::AnalyticEvalNode::GetNextOutputBatch(), impala::PartitionedAggregationNode::Partition::InitStreams(), impala::HashJoinNode::LeftJoinGetNext(), impala::PartitionedHashJoinNode::NextProbeRowBatch(), impala::SelectNode::Open(), impala::SortNode::Open(), impala::TopNNode::Open(), impala::BlockingJoinNode::Open(), Open(), impala::AnalyticEvalNode::Open(), impala::PartitionedAggregationNode::Open(), impala::UnionNode::OpenCurrentChild(), impala::SelectNode::Prepare(), impala::SortNode::Prepare(), impala::UnionNode::Prepare(), impala::TopNNode::Prepare(), impala::BlockingJoinNode::Prepare(), impala::HashJoinNode::Prepare(), Prepare(), impala::AnalyticEvalNode::Prepare(), impala::PartitionedHashJoinNode::Prepare(), impala::PartitionedAggregationNode::Prepare(), impala::PartitionedHashJoinNode::ProcessBuildInput(), impala::AnalyticEvalNode::ProcessChildBatches(), and impala::SortNode::SortInput().

void impala::AggregationNode::Close ( RuntimeState state)
virtual

Close() will get called for every exec node, regardless of what else is called and the status of these calls (i.e. Prepare() may never have been called, or Prepare()/Open()/GetNext() returned with an error). Close() releases all resources that were allocated in Open()/GetNext(), even if the latter ended with an error. Close() can be called if the node has been prepared or the node is closed. The default implementation updates runtime profile counters and calls Close() on the children. Subclasses should check if the node has already been closed (is_closed()), then close themselves, then call the base Close(). Nodes that are using tuples returned by a child may call Close() on their children before their own Close() if the child node has returned eos. It is only safe to call Close() on the child node while the parent node is still returning rows if the parent node fully materializes the child's input.

Reimplemented from impala::ExecNode.

Definition at line 278 of file aggregation-node.cc.

References agg_fn_ctxs_, agg_fn_pool_, aggregate_evaluators_, impala::OldHashTable::Iterator::AtEnd(), build_expr_ctxs_, impala::TupleDescriptor::byte_size(), impala::ExecNode::Close(), impala::Expr::Close(), impala::Tuple::Create(), impala::AggFnEvaluator::Finalize(), impala::OldHashTable::Iterator::GetTuple(), hash_tbl_, impala::ExecNode::is_closed(), needs_finalize_, impala::OldHashTable::Iterator::Next(), output_iterator_, output_tuple_desc_, probe_expr_ctxs_, impala::AggFnEvaluator::Serialize(), and tuple_pool_.

Function * impala::AggregationNode::CodegenProcessRowBatch ( RuntimeState state,
llvm::Function *  update_tuple_fn 
)
private

Codegen the process row batch loop. The loop has already been compiled to IR and loaded into the codegen object. UpdateAggTuple has also been codegen'd to IR. This function will modify the loop subsituting the UpdateAggTuple function call with the (inlined) codegen'd 'update_tuple_fn'.

Definition at line 782 of file aggregation-node.cc.

References impala::LlvmCodeGen::codegen_timer(), impala::RuntimeState::GetCodegen(), impala::LlvmCodeGen::GetFunction(), hash_tbl_, impala::Status::ok(), impala::LlvmCodeGen::OptimizeFunctionWithExprs(), probe_expr_ctxs_, impala::LlvmCodeGen::ReplaceCallSites(), and SCOPED_TIMER.

Referenced by Prepare().

llvm::Function * impala::AggregationNode::CodegenUpdateSlot ( RuntimeState state,
AggFnEvaluator evaluator,
SlotDescriptor slot_desc 
)
private

Codegen for updating aggregate_exprs at slot_idx. Returns NULL if unsuccessful. slot_idx is the idx into aggregate_exprs_ (does not include grouping exprs).

Definition at line 506 of file aggregation-node.cc.

References impala::LlvmCodeGen::FnPrototype::AddArgument(), impala::AggFnEvaluator::agg_op(), impala::SlotDescriptor::CodegenUpdateNull(), impala::AggFnEvaluator::COUNT, impala::CodegenAnyVal::CreateCallWrapped(), impala::SlotDescriptor::field_idx(), impala::TupleDescriptor::GenerateLlvmStruct(), impala::RuntimeState::GetCodegen(), impala::Expr::GetCodegendComputeFn(), impala::Status::GetDetail(), impala::GetHllUpdateFunction2(), impala::CodegenAnyVal::GetIsNull(), impala::CodegenAnyVal::GetNonNullVal(), impala::CodegenAnyVal::GetUnloweredType(), impala::CodegenAnyVal::GetVal(), impala::AggFnEvaluator::input_expr_ctxs(), intermediate_tuple_desc_, impala::SlotDescriptor::is_materialized(), impala::AggFnEvaluator::is_merge(), impala::SlotDescriptor::is_nullable(), impala::TupleRow::LLVM_CLASS_NAME, impala::ExprContext::LLVM_CLASS_NAME, impala::FunctionContextImpl::LLVM_FUNCTIONCONTEXT_NAME, impala::AggFnEvaluator::MAX, impala::AggFnEvaluator::MIN, impala::AggFnEvaluator::NDV, impala::Status::ok(), impala::CodegenAnyVal::SetFromRawValue(), impala::AggFnEvaluator::SUM, impala::CodegenAnyVal::ToNativeValue(), impala::ColumnType::type, impala::SlotDescriptor::type(), impala::Expr::type(), impala::TYPE_BIGINT, impala::TYPE_DOUBLE, impala::TYPE_FLOAT, impala::TYPE_STRING, impala::TYPE_TIMESTAMP, impala::CodegenAnyVal::value(), and VLOG_QUERY.

Referenced by CodegenUpdateTuple().

void impala::ExecNode::CollectNodes ( TPlanNodeType::type  node_type,
std::vector< ExecNode * > *  nodes 
)
inherited

Collect all nodes of given 'node_type' that are part of this subtree, and return in 'nodes'.

Definition at line 359 of file exec-node.cc.

References impala::ExecNode::children_, and impala::ExecNode::type_.

Referenced by impala::ExecNode::CollectScanNodes(), and impala::PlanFragmentExecutor::Prepare().

void impala::ExecNode::CollectScanNodes ( std::vector< ExecNode * > *  nodes)
inherited

Collect all scan node types.

Definition at line 366 of file exec-node.cc.

References impala::ExecNode::CollectNodes().

Referenced by impala::PlanFragmentExecutor::Prepare().

Status impala::ExecNode::CreateNode ( ObjectPool pool,
const TPlanNode &  tnode,
const DescriptorTbl descs,
ExecNode **  node 
)
staticprotectedinherited

Create a single exec node derived from thrift node; place exec node in 'pool'.

Definition at line 260 of file exec-node.cc.

References impala::ObjectPool::Add(), impala::Status::OK, and RETURN_IF_ERROR.

Referenced by impala::ExecNode::CreateTreeHelper().

Status impala::ExecNode::CreateTree ( ObjectPool pool,
const TPlan &  plan,
const DescriptorTbl descs,
ExecNode **  root 
)
staticinherited

Creates exec node tree from list of nodes contained in plan via depth-first traversal. All nodes are placed in pool. Returns error if 'plan' is corrupted, otherwise success.

Definition at line 199 of file exec-node.cc.

References impala::ExecNode::CreateTreeHelper(), impala::Status::OK, and impala::Status::ok().

Referenced by impala::PlanFragmentExecutor::Prepare().

Status impala::ExecNode::CreateTreeHelper ( ObjectPool pool,
const std::vector< TPlanNode > &  tnodes,
const DescriptorTbl descs,
ExecNode parent,
int *  node_idx,
ExecNode **  root 
)
staticprotectedinherited
void impala::AggregationNode::DebugString ( int  indentation_level,
std::stringstream *  out 
) const
protectedvirtual

Recursive helper method for generating a string for DebugString(). Implementations should call DebugString(int, std::stringstream) on their children. Input parameters: indentation_level: Current level in plan tree. Output parameters: out: Stream to accumulate debug string.

Reimplemented from impala::ExecNode.

Definition at line 401 of file aggregation-node.cc.

References aggregate_evaluators_, impala::AggFnEvaluator::DebugString(), impala::ExecNode::DebugString(), impala::Expr::DebugString(), intermediate_tuple_id_, needs_finalize_, output_tuple_id_, and probe_expr_ctxs_.

string impala::ExecNode::DebugString ( ) const
inherited
Tuple * impala::AggregationNode::FinalizeTuple ( Tuple tuple,
MemPool pool 
)
private

Called on the intermediate tuple of each group after all input rows have been consumed and aggregated. Computes the final aggregate values to be returned in GetNext() using the agg fn evaluators' Serialize() or Finalize(). For the Finalize() case if the output tuple is different from the intermediate tuple, then a new tuple is allocated from 'pool' to hold the final result. Returns the tuple holding the final aggregate values.

Definition at line 374 of file aggregation-node.cc.

References agg_fn_ctxs_, aggregate_evaluators_, impala::TupleDescriptor::byte_size(), impala::Tuple::Create(), impala::AggFnEvaluator::Finalize(), impala::Tuple::GetSlot(), intermediate_tuple_desc_, intermediate_tuple_id_, impala::Tuple::IsNull(), needs_finalize_, impala::SlotDescriptor::null_indicator_offset(), output_tuple_desc_, output_tuple_id_, pool, probe_expr_ctxs_, impala::AggFnEvaluator::Serialize(), impala::TupleDescriptor::slots(), impala::SlotDescriptor::tuple_offset(), and impala::RawValue::Write().

Referenced by GetNext().

Status impala::AggregationNode::GetNext ( RuntimeState state,
RowBatch row_batch,
bool eos 
)
virtual

Retrieves rows and returns them via row_batch. Sets eos to true if subsequent calls will not retrieve any more rows. Data referenced by any tuples returned in row_batch must not be overwritten by the callee until Close() is called. The memory holding that data can be returned via row_batch's tuple_data_pool (in which case it may be deleted by the caller) or held on to by the callee. The row_batch, including its tuple_data_pool, will be destroyed by the caller at some point prior to the final Close() call. In other words, if the memory holding the tuple data will be referenced by the callee in subsequent GetNext() calls, it must not be attached to the row_batch's tuple_data_pool. Caller must not be holding any io buffers. This will cause deadlock. TODO: AggregationNode and HashJoinNode cannot be "re-opened" yet.

Implements impala::ExecNode.

Definition at line 230 of file aggregation-node.cc.

References impala::RowBatch::AddRow(), impala::RowBatch::AtCapacity(), impala::OldHashTable::Iterator::AtEnd(), impala::RuntimeState::batch_size(), impala::RowBatch::CommitLastRow(), impala::ExecNode::conjunct_ctxs_, count, COUNTER_SET, impala::ExecNode::EvalConjuncts(), impala::ExecNode::ExecDebugAction(), FinalizeTuple(), get_results_timer_, impala::RowBatch::GetRow(), impala::OldHashTable::Iterator::GetTuple(), impala::OldHashTable::Iterator::Next(), impala::ExecNode::num_rows_returned_, impala::Status::OK, output_iterator_, impala::PrintRow(), impala::ExecNode::QueryMaintenance(), impala::ExecNode::ReachedLimit(), RETURN_IF_CANCELLED, RETURN_IF_ERROR, impala::ExecNode::row_desc(), impala::ExecNode::rows_returned_counter_, impala::ExecNode::runtime_profile_, SCOPED_TIMER, impala::TupleRow::SetTuple(), impala::RowBatch::tuple_data_pool(), and VLOG_ROW.

Referenced by Open().

int impala::ExecNode::GetNodeIdFromProfile ( RuntimeProfile p)
staticinherited

Extract node id from p->name().

Definition at line 62 of file exec-node.cc.

References impala::RuntimeProfile::metadata().

Status impala::AggregationNode::Init ( const TPlanNode &  tnode)
virtual

Initializes this object from the thrift tnode desc. The subclass should do any initialization that can fail in Init() rather than the ctor. If overridden in subclass, must first call superclass's Init().

Reimplemented from impala::ExecNode.

Definition at line 72 of file aggregation-node.cc.

References aggregate_evaluators_, impala::AggFnEvaluator::Create(), impala::Expr::CreateExprTrees(), impala::ExecNode::Init(), impala::Status::OK, impala::ExecNode::pool_, probe_expr_ctxs_, and RETURN_IF_ERROR.

void impala::ExecNode::InitRuntimeProfile ( const std::string &  name)
protectedinherited
virtual bool impala::ExecNode::IsScanNode ( ) const
inlineprotectedvirtualinherited

Reimplemented in impala::ScanNode.

Definition at line 251 of file exec-node.h.

int64_t impala::ExecNode::limit ( ) const
inlineinherited
Status impala::AggregationNode::Prepare ( RuntimeState state)
virtual

Sets up internal structures, etc., without doing any actual work. Must be called prior to Open(). Will only be called once in this node's lifetime. All code generation (adding functions to the LlvmCodeGen object) must happen in Prepare(). Retrieving the jit compiled function pointer must happen in Open(). If overridden in subclass, must first call superclass's Prepare().

Reimplemented from impala::ExecNode.

Definition at line 85 of file aggregation-node.cc.

References impala::ObjectPool::Add(), ADD_COUNTER, ADD_TIMER, impala::LlvmCodeGen::AddFunctionToJit(), impala::ExecNode::AddRuntimeExecOption(), agg_fn_ctxs_, agg_fn_pool_, aggregate_evaluators_, build_expr_ctxs_, build_timer_, impala::ExecNode::child(), impala::RuntimeState::codegen_enabled(), codegen_process_row_batch_fn_, CodegenProcessRowBatch(), CodegenUpdateTuple(), ConstructIntermediateTuple(), impala::RuntimeState::desc_tbl(), impala::ExecNode::expr_mem_tracker(), get_results_timer_, impala::RuntimeState::GetCodegen(), impala::DescriptorTbl::GetTupleDescriptor(), hash_table_buckets_counter_, hash_table_load_factor_counter_, hash_tbl_, intermediate_tuple_desc_, intermediate_tuple_id_, impala::ExecNode::mem_tracker(), impala::RuntimeState::obj_pool(), impala::Status::OK, output_iterator_, output_tuple_desc_, output_tuple_id_, impala::ExecNode::Prepare(), impala::Expr::Prepare(), probe_expr_ctxs_, process_row_batch_fn_, RETURN_IF_ERROR, impala::ExecNode::row_desc(), impala::ExecNode::runtime_profile(), impala::ExecNode::runtime_profile_, SCOPED_TIMER, singleton_intermediate_tuple_, impala::TupleDescriptor::slots(), tuple_pool_, impala::ColumnType::type, impala::SlotDescriptor::type(), impala::TYPE_BOOLEAN, and impala::TYPE_NULL.

void AggregationNode::ProcessRowBatchNoGrouping ( RowBatch batch)
private

Do the aggregation for all tuple rows in the batch.

Definition at line 28 of file aggregation-node-ir.cc.

References impala::RowBatch::GetRow(), impala::RowBatch::num_rows(), singleton_intermediate_tuple_, and UpdateTuple().

Referenced by Open().

Status impala::ExecNode::QueryMaintenance ( RuntimeState state)
protectedvirtualinherited
Status impala::AggregationNode::Reset ( RuntimeState state)
virtual

Resets all data-specific state, returning this node to the state it was in after calling Prepare() and before calling Open(). Prepare() must have already been called before calling Reset(). Open() and GetNext() may have optionally been called. Close() must not have been called. If overridden in a subclass, must call superclass's Reset() at the end. The default implementation calls Reset() on children. Note that this function may be called many times, so should be fast. For example, accumulated memory does not need to be freed on every call if it's expensive.

Reimplemented from impala::ExecNode.

Definition at line 273 of file aggregation-node.cc.

void impala::ExecNode::SetDebugOptions ( int  node_id,
TExecNodePhase::type  phase,
TDebugAction::type  action,
ExecNode tree 
)
staticinherited

Set debug action for node with given id in 'tree'.

Definition at line 332 of file exec-node.cc.

References impala::ExecNode::children_, impala::ExecNode::debug_action_, impala::ExecNode::debug_phase_, and impala::ExecNode::id_.

Referenced by impala::PlanFragmentExecutor::Prepare().

TPlanNodeType::type impala::ExecNode::type ( ) const
inlineinherited
void impala::AggregationNode::UpdateTuple ( Tuple tuple,
TupleRow row 
)
private

Updates the aggregation intermediate tuple 'tuple' with aggregation values computed over 'row'.

Definition at line 369 of file aggregation-node.cc.

References impala::AggFnEvaluator::Add(), agg_fn_ctxs_, and aggregate_evaluators_.

Referenced by ProcessRowBatchNoGrouping(), and ProcessRowBatchWithGrouping().

Member Data Documentation

std::vector<impala_udf::FunctionContext*> impala::AggregationNode::agg_fn_ctxs_
private

FunctionContext for each agg fn and backing pool.

Definition at line 73 of file aggregation-node.h.

Referenced by Close(), CodegenUpdateTuple(), ConstructIntermediateTuple(), FinalizeTuple(), Open(), Prepare(), and UpdateTuple().

boost::scoped_ptr<MemPool> impala::AggregationNode::agg_fn_pool_
private

Definition at line 74 of file aggregation-node.h.

Referenced by Close(), and Prepare().

std::vector<AggFnEvaluator*> impala::AggregationNode::aggregate_evaluators_
private
std::vector<ExprContext*> impala::AggregationNode::build_expr_ctxs_
private

Exprs used to insert constructed aggregation tuple into the hash table. All the exprs are simply SlotRefs for the intermediate tuple.

Definition at line 80 of file aggregation-node.h.

Referenced by Close(), Open(), and Prepare().

RuntimeProfile::Counter* impala::AggregationNode::build_timer_
private

Time spent processing the child rows.

Definition at line 111 of file aggregation-node.h.

Referenced by Open(), and Prepare().

llvm::Function* impala::AggregationNode::codegen_process_row_batch_fn_
private

IR for process row batch. NULL if codegen is disabled.

Definition at line 98 of file aggregation-node.h.

Referenced by Prepare().

TDebugAction::type impala::ExecNode::debug_action_
protectedinherited
TExecNodePhase::type impala::ExecNode::debug_phase_
protectedinherited

debug-only: if debug_action_ is not INVALID, node will perform action in debug_phase_

Definition at line 219 of file exec-node.h.

Referenced by impala::ExecNode::ExecDebugAction(), and impala::ExecNode::SetDebugOptions().

boost::mutex impala::ExecNode::exec_options_lock_
protectedinherited

Execution options that are determined at runtime. This is added to the runtime profile at Close(). Examples for options logged here would be "Codegen Enabled"

Definition at line 238 of file exec-node.h.

Referenced by impala::ExecNode::AddRuntimeExecOption().

boost::scoped_ptr<MemTracker> impala::ExecNode::expr_mem_tracker_
protectedinherited

MemTracker that should be used for ExprContexts.

Definition at line 233 of file exec-node.h.

Referenced by impala::ExecNode::expr_mem_tracker(), and impala::ExecNode::Prepare().

RuntimeProfile::Counter* impala::AggregationNode::get_results_timer_
private

Time spent returning the aggregated rows.

Definition at line 113 of file aggregation-node.h.

Referenced by GetNext(), and Prepare().

RuntimeProfile::Counter* impala::AggregationNode::hash_table_buckets_counter_
private

Num buckets in hash table.

Definition at line 115 of file aggregation-node.h.

Referenced by Open(), and Prepare().

RuntimeProfile::Counter* impala::AggregationNode::hash_table_load_factor_counter_
private

Load factor in hash table.

Definition at line 117 of file aggregation-node.h.

Referenced by Open(), and Prepare().

boost::scoped_ptr<OldHashTable> impala::AggregationNode::hash_tbl_
private
TupleDescriptor* impala::AggregationNode::intermediate_tuple_desc_
private
TupleId impala::AggregationNode::intermediate_tuple_id_
private

Tuple into which Update()/Merge()/Serialize() results are stored.

Definition at line 83 of file aggregation-node.h.

Referenced by DebugString(), FinalizeTuple(), and Prepare().

const char * impala::AggregationNode::LLVM_CLASS_NAME = "class.impala::AggregationNode"
static

Definition at line 61 of file aggregation-node.h.

Referenced by CodegenUpdateTuple().

boost::scoped_ptr<MemTracker> impala::ExecNode::mem_tracker_
protectedinherited

Account for peak memory used by this node.

Definition at line 230 of file exec-node.h.

Referenced by impala::ExecNode::mem_tracker(), and impala::ExecNode::Prepare().

bool impala::AggregationNode::needs_finalize_
private

Certain aggregates require a finalize step, which is the final step of the aggregate after consuming all input rows. The finalize step converts the aggregate value into its final form. This is true if this node contains aggregate that requires a finalize step.

Definition at line 108 of file aggregation-node.h.

Referenced by Close(), DebugString(), and FinalizeTuple().

OldHashTable::Iterator impala::AggregationNode::output_iterator_
private

Definition at line 68 of file aggregation-node.h.

Referenced by Close(), GetNext(), Open(), and Prepare().

TupleDescriptor* impala::AggregationNode::output_tuple_desc_
private

Definition at line 89 of file aggregation-node.h.

Referenced by Close(), FinalizeTuple(), and Prepare().

TupleId impala::AggregationNode::output_tuple_id_
private

Tuple into which Finalize() results are stored. Possibly the same as the intermediate tuple.

Definition at line 88 of file aggregation-node.h.

Referenced by DebugString(), FinalizeTuple(), and Prepare().

std::vector<ExprContext*> impala::AggregationNode::probe_expr_ctxs_
private

Exprs used to evaluate input rows.

Definition at line 77 of file aggregation-node.h.

Referenced by Close(), CodegenProcessRowBatch(), CodegenUpdateTuple(), ConstructIntermediateTuple(), DebugString(), FinalizeTuple(), Init(), Open(), and Prepare().

ProcessRowBatchFn impala::AggregationNode::process_row_batch_fn_
private

Jitted ProcessRowBatch function pointer. Null if codegen is disabled.

Definition at line 102 of file aggregation-node.h.

Referenced by Open(), and Prepare().

RowDescriptor impala::ExecNode::row_descriptor_
protectedinherited
const string impala::ExecNode::ROW_THROUGHPUT_COUNTER = "RowsReturnedRate"
staticinherited

Names of counters shared by all exec nodes.

Definition at line 169 of file exec-node.h.

Referenced by impala::ExecNode::Prepare().

RuntimeProfile::Counter* impala::ExecNode::rows_returned_rate_
protectedinherited

Definition at line 227 of file exec-node.h.

Referenced by impala::ExecNode::Prepare().

std::string impala::ExecNode::runtime_exec_options_
protectedinherited

Definition at line 239 of file exec-node.h.

Referenced by impala::ExecNode::AddRuntimeExecOption().

Tuple* impala::AggregationNode::singleton_intermediate_tuple_
private

Intermediate result of aggregation w/o GROUP BY. Note: can be NULL even if there is no grouping if the result tuple is 0 width

Definition at line 93 of file aggregation-node.h.

Referenced by Prepare(), and ProcessRowBatchNoGrouping().

boost::scoped_ptr<MemPool> impala::AggregationNode::tuple_pool_
private

Definition at line 95 of file aggregation-node.h.

Referenced by Close(), ConstructIntermediateTuple(), and Prepare().

TPlanNodeType::type impala::ExecNode::type_
protectedinherited

Definition at line 210 of file exec-node.h.

Referenced by impala::ExecNode::CollectNodes(), and impala::ExecNode::type().


The documentation for this class was generated from the following files: