taco-db
0.1.0
|
ExprNode
is an abstract class of all expressions.
More...
#include <expr/ExprNode.h>
Public Member Functions | |
template<class ... UniquePtrs> | |
ExprNode (NodeTag tag, UniquePtrs &&...input) | |
Base constructor for all expression nodes. More... | |
virtual | ~ExprNode () |
Deconstructor. More... | |
virtual Datum | Eval (const std::vector< NullableDatumRef > &record) const =0 |
Evaluate function upon a deserialized record. More... | |
virtual Datum | Eval (const char *record) const =0 |
Evaluate function on top of a serialized record. More... | |
std::shared_ptr< const SysTable_Type > | ReturnType () const |
Derive the return type of this expression. 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 |
virtual void | node_properties_to_string (std::string &buf, int indent) const =0 |
Protected Attributes | |
std::shared_ptr< const SysTable_Type > | m_type |
Additional Inherited Members | |
Static Public Member Functions inherited from taco::TreeNode | |
static void | append_indent (std::string &buf, int indent) |
ExprNode
is an abstract class of all expressions.
It provides the basic interface to construct, evaluate and derive return type of expressions. An expression should be evaluated upon a record, where essential schema and type information is passed through certain levels of the expression tree (e.g. Variable, Literal, Cast, etc.).
All expression nodes can be evaluated upon a deserialized record (as a record of NullableDatumRef
), or a serialized record (as a const char *
buffer of record payload). Variable
nodes can refer to individual fields in the record using field IDs. An expression node may have to recursively call Eval
on its subtree(s)/read from the supplied record, and perform appropriate operation on the subtree result to produce its own result. The result of Eval
call must have full ownership of its underlying memory (i.e., Datum::HasExternalRef()
on the returned datum must return false
).
|
inline |
Base constructor for all expression nodes.
It is marked with a node tag (see include/utils/tree/node_Tags.inc for more details) and unique pointers to all of its children execution states. The unique pointers to its children will be moved to TreeNode
internal states after the construction so you don't have to remember it separately.
Note: You can use TAG(ClassName)
to get the corresponding tag for a plan execution state. For example, TAG(Literal)
will give you the tag of Literal
.
|
inlinevirtual |
Deconstructor.
|
pure virtual |
Evaluate function on top of a serialized record.
Implemented in taco::Variable, taco::UnaryOperator, taco::OrOperator, taco::Literal, taco::FuncCallOperator, taco::Cast, taco::BinaryOperator, and taco::AndOperator.
|
pure virtual |
Evaluate function upon a deserialized record.
Implemented in taco::Variable, taco::UnaryOperator, taco::OrOperator, taco::Literal, taco::FuncCallOperator, taco::Cast, taco::BinaryOperator, and taco::AndOperator.
|
inline |
Derive the return type of this expression.
|
protected |