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