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 {
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
taco::TableScanState::node_properties_to_string
void node_properties_to_string(std::string &buf, int indent) const override
Definition: TableScanState.cpp:52
taco::TableScanState::m_extracted
bool m_extracted
Definition: TableScanState.h:52
taco::DatumRef
A DatumRef object is a read-only reference to an C++ object of a supported runtime type.
Definition: datum.h:823
taco::TableScanState::m_fields
std::vector< Datum > m_fields
Definition: TableScanState.h:56
taco::TableScanState::m_tabiter
Table::Iterator m_tabiter
Definition: TableScanState.h:55
taco
Definition: datum.h:28
taco::TableScanState::~TableScanState
~TableScanState() override
Definition: TableScanState.cpp:45
taco::TableScanState::save_position
Datum save_position() const override
Returns a saved position where this plan execution state is at.
Definition: TableScanState.cpp:127
Table.h
taco::Table::Iterator
The Iterator interface for scanning the heap file.
Definition: Table.h:185
taco::TableScanState::get_record
std::vector< NullableDatumRef > get_record() override
Return the deserialized output record to which this execution state currently points.
Definition: TableScanState.cpp:87
taco::TableScanState::rewind
void rewind() override
Rewind the execution state as if it has just been initialized.
Definition: TableScanState.cpp:118
taco::TableScanState::TableScanState
TableScanState(const TableScan *plan, std::unique_ptr< Table > table)
Definition: TableScanState.cpp:31
tdb.h
TableScan.h
taco::TableScanState::m_table
std::unique_ptr< Table > m_table
Definition: TableScanState.h:54
taco::TableScanState
TableScanState is the execution state for heap file table scan.
Definition: TableScanState.h:22
taco::PlanExecState
PlanExecState is an abstract interface for execution state of various query plan.
Definition: PlanExecState.h:19
taco::TableScanState::next_tuple
bool next_tuple() override
Moves the iterator of this execution state to the next output record.
Definition: TableScanState.cpp:66
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::TableScanState::get_plan
const PlanNode * get_plan() const
Returns the corresponding plan.
Definition: TableScanState.h:43
PlanExecState.h
taco::TableScanState::m_at_end
bool m_at_end
Definition: TableScanState.h:53
taco::PlanNode
PlanNode is an abstract interface representing physical query plan that does not bound with any parti...
Definition: PlanNode.h:26
taco::TableScan
TableScan is the physical plan for heap file table scanning.
Definition: TableScan.h:18
taco::TableScanState::close
void close() override
Clear internal states, mark we have finish retrieving output records from this execution state,...
Definition: TableScanState.cpp:111
taco::TableScanState::m_plan
const TableScan * m_plan
Definition: TableScanState.h:50
taco::TableScanState::init
void init() override
Initialize this plan execution state, set m_initialized to true and initialize all corresponding stat...
Definition: TableScanState.cpp:57