Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <sort-exec-exprs.h>
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_ |
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.
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.
|
inline |
Can only be used after calling Prepare()
Definition at line 55 of file sort-exec-exprs.h.
References lhs_ordering_expr_ctxs_.
Referenced by impala::ExecNode::AddExprCtxsToFree(), impala::SortNode::DebugString(), impala::TopNNode::DebugString(), impala::SortNode::Open(), impala::TopNNode::Open(), and impala::ExchangeNode::Open().
Status impala::SortExecExprs::Open | ( | RuntimeState * | state | ) |
Open all expressions used for sorting and tuple materialization.
Definition at line 53 of file sort-exec-exprs.cc.
References impala::Expr::Clone(), lhs_ordering_expr_ctxs_, materialize_tuple_, impala::Status::OK, impala::Expr::Open(), RETURN_IF_ERROR, rhs_ordering_expr_ctxs_, and sort_tuple_slot_expr_ctxs_.
Referenced by impala::SortNode::Open(), impala::TopNNode::Open(), and impala::ExchangeNode::Open().
Status impala::SortExecExprs::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.
Definition at line 42 of file sort-exec-exprs.cc.
References lhs_ordering_expr_ctxs_, materialize_tuple_, impala::Status::OK, impala::Expr::Prepare(), RETURN_IF_ERROR, and sort_tuple_slot_expr_ctxs_.
Referenced by impala::SortNode::Prepare(), impala::TopNNode::Prepare(), and impala::ExchangeNode::Prepare().
|
inline |
Can only be used after calling Open()
Definition at line 59 of file sort-exec-exprs.h.
References rhs_ordering_expr_ctxs_.
Referenced by impala::ExecNode::AddExprCtxsToFree(), impala::SortNode::Open(), impala::TopNNode::Open(), and impala::ExchangeNode::Open().
|
inline |
Definition at line 50 of file sort-exec-exprs.h.
References sort_tuple_slot_expr_ctxs_.
Referenced by impala::ExecNode::AddExprCtxsToFree(), impala::TopNNode::InsertTupleRow(), and impala::SortNode::Open().
|
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().
|
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.
|
private |
Definition at line 66 of file sort-exec-exprs.h.
Referenced by Close(), Open(), and rhs_ordering_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().