taco-db  0.1.0
Public Member Functions | Protected Attributes | List of all members
taco::ExprNode Class Referenceabstract

ExprNode is an abstract class of all expressions. More...

#include <expr/ExprNode.h>

Inheritance diagram for taco::ExprNode:
taco::TreeNode taco::AndOperator taco::BinaryOperator taco::Cast taco::FuncCallOperator taco::Literal taco::OrOperator taco::UnaryOperator taco::Variable

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_TypeReturnType () 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
 
TreeNodeoperator= (TreeNode &&)=default
 
 TreeNode (const TreeNode &)=delete
 
TreeNodeoperator= (const TreeNode &)=delete
 
constexpr NodeTag get_tag () const
 
TreeNodeget_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_Typem_type
 

Additional Inherited Members

- Static Public Member Functions inherited from taco::TreeNode
static void append_indent (std::string &buf, int indent)
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ ExprNode()

template<class ... UniquePtrs>
taco::ExprNode::ExprNode ( NodeTag  tag,
UniquePtrs &&...  input 
)
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.

◆ ~ExprNode()

virtual taco::ExprNode::~ExprNode ( )
inlinevirtual

Deconstructor.

Member Function Documentation

◆ Eval() [1/2]

virtual Datum taco::ExprNode::Eval ( const char *  record) const
pure virtual

◆ Eval() [2/2]

virtual Datum taco::ExprNode::Eval ( const std::vector< NullableDatumRef > &  record) const
pure virtual

◆ ReturnType()

std::shared_ptr<const SysTable_Type> taco::ExprNode::ReturnType ( ) const
inline

Derive the return type of this expression.

Member Data Documentation

◆ m_type

std::shared_ptr<const SysTable_Type> taco::ExprNode::m_type
protected

The documentation for this class was generated from the following file: