taco-db
0.1.0
|
CartesianProductState
is the execution state for cartesian product.
More...
#include <execution/CartesianProductState.h>
Public Member Functions | |
~CartesianProductState () override | |
void | node_properties_to_string (std::string &buf, int indent) const override |
void | init () override |
Initialize this plan execution state, set m_initialized to true and initialize all corresponding states (including its children) to get ready for query processing. More... | |
bool | next_tuple () override |
Moves the iterator of this execution state to the next output record. More... | |
std::vector< NullableDatumRef > | get_record () override |
Return the deserialized output record to which this execution state currently points. More... | |
void | close () override |
Clear internal states, mark we have finish retrieving output records from this execution state, and mark the execution state no longer initialzied. More... | |
void | rewind () override |
Rewind the execution state as if it has just been initialized. More... | |
Datum | save_position () const override |
Returns a saved position where this plan execution state is at. More... | |
bool | rewind (DatumRef saved_position) override |
Rewinds the execution state to the same as the one that was previously saved and returns if the rewinded state is currently at a valid record. More... | |
const PlanNode * | get_plan () const override |
Returns the corresponding plan. More... | |
Public Member Functions inherited from taco::PlanExecState | |
template<class ... UniquePtrs> | |
PlanExecState (NodeTag tag, UniquePtrs &&...input) | |
Base constructor for all execution states. More... | |
virtual | ~PlanExecState () |
Deconstructor of PlanExecState. More... | |
Public Member Functions inherited from taco::TreeNode | |
template<class ... UniquePtrs> | |
TreeNode (NodeTag tag, UniquePtrs &&...input) | |
virtual | ~TreeNode () |
TreeNode (TreeNode &&)=default | |
TreeNode & | operator= (TreeNode &&)=default |
TreeNode (const TreeNode &)=delete | |
TreeNode & | operator= (const TreeNode &)=delete |
constexpr NodeTag | get_tag () const |
TreeNode * | get_input (size_t i) const |
template<class Node > | |
Node * | get_input_as (size_t i) const |
std::string | to_string () const |
void | node_to_string (std::string &buf, int indent) const |
Prints the node contents to a string buffer. More... | |
const char * | node_name () const |
Private Member Functions | |
CartesianProductState (const CartesianProduct *plan, std::unique_ptr< PlanExecState > &&left, std::unique_ptr< PlanExecState > &&right) | |
Private Attributes | |
const CartesianProduct * | m_plan |
Friends | |
class | CartesianProduct |
Additional Inherited Members | |
Static Public Member Functions inherited from taco::TreeNode | |
static void | append_indent (std::string &buf, int indent) |
Protected Member Functions inherited from taco::PlanExecState | |
PlanExecState * | get_child (size_t i) const |
Utility function to get the raw pointer of i-th child of this execution state. More... | |
Protected Attributes inherited from taco::PlanExecState | |
bool | m_initialized |
CartesianProductState
is the execution state for cartesian product.
This execution state should iterate through all n * m
output records once.
CAUTION: You need to make sure the current record's NullableDatumRef
that the exeuction state pointing at is always memory safe until the operator is closed
|
override |
|
private |
|
overridevirtual |
Clear internal states, mark we have finish retrieving output records from this execution state, and mark the execution state no longer initialzied.
A closed operator may be reopened by calling init()
again.
Implements taco::PlanExecState.
|
inlineoverridevirtual |
Returns the corresponding plan.
Implements taco::PlanExecState.
|
overridevirtual |
Return the deserialized output record to which this execution state currently points.
The deserialized record represented by a vector of NullableDatumRef
should be SAFE to access until the next_tuple()
is called again on the same execution state.
It should return the first output record after the first next_tuple call. The behavior of calling get_record()
before the first next_tuple()
is undefined.
Implements taco::PlanExecState.
|
overridevirtual |
Initialize this plan execution state, set m_initialized
to true and initialize all corresponding states (including its children) to get ready for query processing.
Implements taco::PlanExecState.
|
overridevirtual |
Moves the iterator of this execution state to the next output record.
Returns true
if there is such a record. The caller should be able to get the current deserialized record through get_record()
before another next_tuple()
is called or the plan execution state is implicitly or explicitly ended. You should make sure memory holding this record is safe (on pinned page or copied somewhere) until the next next_tuple()
call.
Implements taco::PlanExecState.
|
overridevirtual |
Implements taco::TreeNode.
|
overridevirtual |
Rewind the execution state as if it has just been initialized.
Thus, after this call, next_tuple()
will trigger another round of scan from the very beginning. Calling rewind()
should have the same effect as calling close()
followed by another init()
, but is usually a more efficient because it may avoid certain memory deallocation/allocation or recomputation.
Note that an operator must support this overload of rewind() even if it does not support rewinding to a saved position.
Implements taco::PlanExecState.
|
overridevirtual |
Rewinds the execution state to the same as the one that was previously saved and returns if the rewinded state is currently at a valid record.
Calling get_record()
on the rewinded object will return the same values for the same record at the time the the saved_position
was returned by save_position()
.
It is undefined if this function is passed a saved_position
that was not returned by this plan execution state object.
Reimplemented from taco::PlanExecState.
|
overridevirtual |
Returns a saved position where this plan execution state is at.
A call to rewind(DatumRef)
with the saved position will rewind the execution state to the same as its current state. Calling get_record()
on the rewinded object will return the same values for the same record at the time the save_position()
is called. The returned saved position must not be null.
An operator that does not support rewinding to a saved position should never override this function.
Reimplemented from taco::PlanExecState.
|
friend |
|
private |