Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sort-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 #ifndef IMPALA_EXEC_SORT_NODE_H
16 #define IMPALA_EXEC_SORT_NODE_H
17 
18 #include "exec/exec-node.h"
19 #include "exec/sort-exec-exprs.h"
20 #include "runtime/sorter.h"
22 
23 namespace impala {
24 
34 class SortNode : public ExecNode {
35  public:
36  SortNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl& descs);
37  ~SortNode();
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  protected:
47  virtual void DebugString(int indentation_level, std::stringstream* out) const;
48 
49  private:
52 
57 
59  int64_t offset_;
61 
63  boost::scoped_ptr<Sorter> sorter_;
64 
67  std::vector<bool> is_asc_order_;
68  std::vector<bool> nulls_first_;
69 };
70 
71 }
72 
73 #endif
boost::scoped_ptr< Sorter > sorter_
Object used for external sorting.
Definition: sort-node.h:63
int64_t num_rows_skipped_
Definition: sort-node.h:60
virtual Status Prepare(RuntimeState *state)
Definition: sort-node.cc:42
virtual Status Open(RuntimeState *state)
Definition: sort-node.cc:51
virtual Status Reset(RuntimeState *state)
Definition: sort-node.cc:118
std::vector< bool > is_asc_order_
Definition: sort-node.h:67
virtual Status Init(const TPlanNode &tnode)
Definition: sort-node.cc:34
std::string DebugString() const
Returns a string representation in DFS order of the plan rooted at this.
Definition: exec-node.cc:345
Status SortInput(RuntimeState *state)
Fetch input rows and feed them to the sorter until the input is exhausted.
Definition: sort-node.cc:143
virtual void Close(RuntimeState *state)
Definition: sort-node.cc:123
ObjectPool pool
int64_t offset_
Number of rows to skip.
Definition: sort-node.h:59
Status CreateBlockMgr(RuntimeState *state)
SortExecExprs sort_exec_exprs_
Expressions and parameters used for tuple materialization and tuple comparison.
Definition: sort-node.h:66
SortNode(ObjectPool *pool, const TPlanNode &tnode, const DescriptorTbl &descs)
Definition: sort-node.cc:25
virtual Status GetNext(RuntimeState *state, RowBatch *row_batch, bool *eos)
Definition: sort-node.cc:78
std::vector< bool > nulls_first_
Definition: sort-node.h:68