taco-db  0.1.0
TableScanState.h
Go to the documentation of this file.
1 #ifndef EXECUTION_TABLESCANSTATE_H
2 #define EXECUTION_TABLESCANSTATE_H
3 
4 #include "tdb.h"
5 
7 #include "plan/TableScan.h"
8 #include "storage/Table.h"
9 
10 namespace taco {
11 
23 public:
24  ~TableScanState() override;
25 
26  void node_properties_to_string(std::string &buf, int indent) const override;
27 
28  void init() override;
29 
30  bool next_tuple() override;
31 
32  std::vector<NullableDatumRef> get_record() override;
33 
34  void close() override;
35 
36  void rewind() override;
37 
38  Datum save_position() const override;
39 
40  bool rewind(DatumRef saved_position) override;
41 
42  const PlanNode*
43  get_plan() const override {
44  return m_plan;
45  }
46 
47 private:
48  TableScanState(const TableScan *plan, std::unique_ptr<Table> table);
49 
50  const TableScan *m_plan;
51 
53  bool m_at_end;
54  std::unique_ptr<Table> m_table;
56  std::vector<Datum> m_fields;
57 
58  friend class TableScan;
59 };
60 
61 } // namespace taco
62 
63 #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
TableScanState is the execution state for heap file table scan.
Definition: TableScanState.h:22
std::vector< NullableDatumRef > get_record() override
Return the deserialized output record to which this execution state currently points.
Definition: TableScanState.cpp:87
std::vector< Datum > m_fields
Definition: TableScanState.h:56
bool next_tuple() override
Moves the iterator of this execution state to the next output record.
Definition: TableScanState.cpp:66
bool m_extracted
Definition: TableScanState.h:52
~TableScanState() override
Definition: TableScanState.cpp:45
std::unique_ptr< Table > m_table
Definition: TableScanState.h:54
void rewind() override
Rewind the execution state as if it has just been initialized.
Definition: TableScanState.cpp:118
Datum save_position() const override
Returns a saved position where this plan execution state is at.
Definition: TableScanState.cpp:127
void init() override
Initialize this plan execution state, set m_initialized to true and initialize all corresponding stat...
Definition: TableScanState.cpp:57
const PlanNode * get_plan() const override
Returns the corresponding plan.
Definition: TableScanState.h:43
void node_properties_to_string(std::string &buf, int indent) const override
Definition: TableScanState.cpp:52
TableScanState(const TableScan *plan, std::unique_ptr< Table > table)
Definition: TableScanState.cpp:31
Table::Iterator m_tabiter
Definition: TableScanState.h:55
bool m_at_end
Definition: TableScanState.h:53
const TableScan * m_plan
Definition: TableScanState.h:50
void close() override
Clear internal states, mark we have finish retrieving output records from this execution state,...
Definition: TableScanState.cpp:111
TableScan is the physical plan for heap file table scanning.
Definition: TableScan.h:18
The Iterator interface for scanning the heap file.
Definition: Table.h:185
Definition: datum.h:28