taco-db  0.1.0
SortState.h
Go to the documentation of this file.
1 #ifndef EXECUTION_SORTSTATE_H
2 #define EXECUTION_SORTSTATE_H
3 
5 #include "plan/Sort.h"
6 #include "extsort/ExternalSort.h"
7 
8 namespace taco {
9 
19 class SortState: public PlanExecState {
20 public:
21  ~SortState() override;
22 
23  void init() override;
24 
25  bool next_tuple() override;
26 
27  void node_properties_to_string(std::string& buf, int indent) const override;
28 
29  std::vector<NullableDatumRef> get_record() override;
30 
31  void close() override;
32 
33  void rewind() override;
34 
35  Datum save_position() const override;
36 
37  bool rewind(DatumRef saved_position) override;
38 
39  const PlanNode*
40  get_plan() const override {
41  return m_plan;
42  }
43 
44 private:
45  SortState(const Sort* plan, std::unique_ptr<PlanExecState>&& child);
46 
47  const Sort* m_plan;
48 
49  // You can add your own states here.
50 
51  friend class Sort;
52 };
53 
54 } // namespace taco
55 
56 #endif
A DatumRef object is a read-only reference to an C++ object of a supported runtime type.
Definition: datum.h:823
A Datum stores and possibly manage the memory resource of a read-only value of a plain fixed-length C...
Definition: datum.h:250
PlanExecState is an abstract interface for execution state of various query plan.
Definition: PlanExecState.h:19
PlanNode is an abstract interface representing physical query plan that does not bound with any parti...
Definition: PlanNode.h:26
SortState is the execution state for sorting.
Definition: SortState.h:19
~SortState() override
Definition: SortState.cpp:18
void close() override
Clear internal states, mark we have finish retrieving output records from this execution state,...
Definition: SortState.cpp:45
SortState(const Sort *plan, std::unique_ptr< PlanExecState > &&child)
Definition: SortState.cpp:10
Datum save_position() const override
Returns a saved position where this plan execution state is at.
Definition: SortState.cpp:55
void init() override
Initialize this plan execution state, set m_initialized to true and initialize all corresponding stat...
Definition: SortState.cpp:23
void rewind() override
Rewind the execution state as if it has just been initialized.
Definition: SortState.cpp:50
const Sort * m_plan
Definition: SortState.h:47
std::vector< NullableDatumRef > get_record() override
Return the deserialized output record to which this execution state currently points.
Definition: SortState.cpp:39
bool next_tuple() override
Moves the iterator of this execution state to the next output record.
Definition: SortState.cpp:28
const PlanNode * get_plan() const override
Returns the corresponding plan.
Definition: SortState.h:40
void node_properties_to_string(std::string &buf, int indent) const override
Definition: SortState.cpp:34
Sort is the physical plan for sorting operators.
Definition: Sort.h:19
Definition: datum.h:28