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

#include <sort-exec-exprs.h>

Collaboration diagram for impala::SortExecExprs:

Public Member Functions

Status Init (const TSortInfo &sort_info, ObjectPool *pool)
 Initialize the expressions from a TSortInfo using the specified pool. More...
 
Status Init (const std::vector< TExpr > &ordering_exprs, const std::vector< TExpr > *sort_tuple_slot_exprs, ObjectPool *pool)
 
Status Prepare (RuntimeState *state, const RowDescriptor &child_row_desc, const RowDescriptor &output_row_desc, MemTracker *expr_mem_tracker)
 Prepare all expressions used for sorting and tuple materialization. More...
 
Status Open (RuntimeState *state)
 Open all expressions used for sorting and tuple materialization. More...
 
void Close (RuntimeState *state)
 Close all expressions used for sorting and tuple materialization. More...
 
const std::vector< ExprContext * > & sort_tuple_slot_expr_ctxs () const
 
const std::vector< ExprContext * > & lhs_ordering_expr_ctxs () const
 Can only be used after calling Prepare() More...
 
const std::vector< ExprContext * > & rhs_ordering_expr_ctxs () const
 Can only be used after calling Open() More...
 

Private Attributes

std::vector< ExprContext * > lhs_ordering_expr_ctxs_
 Create two ExprContexts for evaluating over the TupleRows. More...
 
std::vector< ExprContext * > rhs_ordering_expr_ctxs_
 
bool materialize_tuple_
 
std::vector< ExprContext * > sort_tuple_slot_expr_ctxs_
 

Detailed Description

Helper class to Prepare() , Open() and Close() the ordering expressions used to perform comparisons in a sort. Used by TopNNode, SortNode, and MergingExchangeNode. When two rows are compared, the ordering expressions are evaluated once for each side. TopN and Sort materialize input rows into a single tuple before sorting. If materialize_tuple_ is true, SortExecExprs also stores the slot expressions used to materialize the sort tuples.

Definition at line 29 of file sort-exec-exprs.h.

Member Function Documentation

void impala::SortExecExprs::Close ( RuntimeState state)

Close all expressions used for sorting and tuple materialization.

Definition at line 62 of file sort-exec-exprs.cc.

References impala::Expr::Close(), lhs_ordering_expr_ctxs_, materialize_tuple_, rhs_ordering_expr_ctxs_, and sort_tuple_slot_expr_ctxs_.

Referenced by impala::SortNode::Close(), impala::TopNNode::Close(), and impala::ExchangeNode::Close().

Status impala::SortExecExprs::Init ( const TSortInfo &  sort_info,
ObjectPool pool 
)

Initialize the expressions from a TSortInfo using the specified pool.

Definition at line 21 of file sort-exec-exprs.cc.

Referenced by impala::SortNode::Init(), impala::TopNNode::Init(), and impala::ExchangeNode::Init().

Status impala::SortExecExprs::Init ( const std::vector< TExpr > &  ordering_exprs,
const std::vector< TExpr > *  sort_tuple_slot_exprs,
ObjectPool pool 
)

Initialize the ordering and (optionally) materialization expressions from the thrift TExprs into the specified pool. sort_tuple_slot_exprs is NULL if the tuple is not materialized.

const std::vector<ExprContext*>& impala::SortExecExprs::lhs_ordering_expr_ctxs ( ) const
inline
Status impala::SortExecExprs::Open ( RuntimeState state)
Status impala::SortExecExprs::Prepare ( RuntimeState state,
const RowDescriptor child_row_desc,
const RowDescriptor output_row_desc,
MemTracker expr_mem_tracker 
)
const std::vector<ExprContext*>& impala::SortExecExprs::rhs_ordering_expr_ctxs ( ) const
inline
const std::vector<ExprContext*>& impala::SortExecExprs::sort_tuple_slot_expr_ctxs ( ) const
inline

Member Data Documentation

std::vector<ExprContext*> impala::SortExecExprs::lhs_ordering_expr_ctxs_
private

Create two ExprContexts for evaluating over the TupleRows.

Definition at line 65 of file sort-exec-exprs.h.

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

bool impala::SortExecExprs::materialize_tuple_
private

If true, the tuples to be sorted are materialized by sort_tuple_slot_exprs_ before the actual sort is performed.

Definition at line 70 of file sort-exec-exprs.h.

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

std::vector<ExprContext*> impala::SortExecExprs::rhs_ordering_expr_ctxs_
private

Definition at line 66 of file sort-exec-exprs.h.

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

std::vector<ExprContext*> impala::SortExecExprs::sort_tuple_slot_expr_ctxs_
private

Expressions used to materialize slots in the tuples to be sorted. One expr per slot in the materialized tuple. Valid only if materialize_tuple_ is true.

Definition at line 75 of file sort-exec-exprs.h.

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


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