5#include <unordered_map>
6#include <unordered_set>
20using expression_pair = std::pair<std::shared_ptr<Expression>, std::shared_ptr<Expression>>;
30class Expression :
public std::enable_shared_from_this<Expression> {
40 const std::shared_ptr<Expression>& left,
const std::shared_ptr<Expression>& right,
46 const std::shared_ptr<Expression>& child, std::string
uniqueName)
87 virtual std::unique_ptr<Expression>
copy()
const {
91 template<
class TARGET>
95 template<
class TARGET>
99 template<
class TARGET>
103 template<
class TARGET>
123 std::size_t
operator()(
const std::shared_ptr<Expression>& expression)
const {
124 return std::hash<std::string>{}(expression->getUniqueName());
130 const std::shared_ptr<Expression>& right)
const {
131 return left->getUniqueName() == right->getUniqueName();
#define KU_ASSERT(condition)
Definition assert.h:19
Definition expression.h:30
const TARGET * constPtrCast() const
Definition expression.h:104
bool operator==(const Expression &rhs) const
Definition expression.h:83
std::string uniqueName
Definition expression.h:117
std::string toString() const
Definition expression.h:85
expression_vector splitOnAND()
const common::LogicalType & getDataType() const
Definition expression.h:64
void setAlias(const std::string &newAlias)
Definition expression.h:66
std::shared_ptr< Expression > getChild(common::idx_t idx) const
Definition expression.h:71
common::ExpressionType expressionType
Definition expression.h:112
const TARGET & constCast() const
Definition expression.h:100
std::string getUniqueName() const
Definition expression.h:58
expression_vector children
Definition expression.h:119
virtual std::unique_ptr< Expression > copy() const
Definition expression.h:87
TARGET * ptrCast()
Definition expression.h:96
friend class ExpressionChildrenCollector
Definition expression.h:31
void setChild(common::idx_t idx, std::shared_ptr< Expression > child)
Definition expression.h:76
virtual ~Expression()=default
bool hasAlias() const
Definition expression.h:67
std::string getAlias() const
Definition expression.h:68
virtual std::string toStringInternal() const =0
common::idx_t getNumChildren() const
Definition expression.h:70
expression_vector getChildren() const
Definition expression.h:75
DELETE_COPY_DEFAULT_MOVE(Expression)
Expression(common::ExpressionType expressionType, common::LogicalType dataType, expression_vector children, std::string uniqueName)
Definition expression.h:34
void setUniqueName(const std::string &name)
Definition expression.h:57
virtual void cast(const common::LogicalType &type)
common::LogicalType dataType
Definition expression.h:113
std::string alias
Definition expression.h:118
TARGET & cast()
Definition expression.h:92
Expression(common::ExpressionType expressionType, common::LogicalType dataType, const std::shared_ptr< Expression > &left, const std::shared_ptr< Expression > &right, std::string uniqueName)
Definition expression.h:39
Expression(common::ExpressionType expressionType, common::LogicalType dataType, std::string uniqueName)
Definition expression.h:50
Expression(common::ExpressionType expressionType, common::LogicalType dataType, const std::shared_ptr< Expression > &child, std::string uniqueName)
Definition expression.h:45
std::unordered_map< std::shared_ptr< Expression >, T, ExpressionHasher, ExpressionEquality > expression_map
Definition expression.h:27
std::unordered_set< std::shared_ptr< Expression >, ExpressionHasher, ExpressionEquality > expression_set
Definition expression.h:24
std::pair< std::shared_ptr< Expression >, std::shared_ptr< Expression > > expression_pair
Definition expression.h:20
std::vector< std::shared_ptr< Expression > > expression_vector
Definition expression.h:19
uint32_t idx_t
Definition types.h:41
ExpressionType
Definition expression_type.h:9
TO ku_dynamic_cast(FROM *old)
Definition cast.h:11
Definition array_utils.h:7
Definition expression.h:128
bool operator()(const std::shared_ptr< Expression > &left, const std::shared_ptr< Expression > &right) const
Definition expression.h:129
Definition expression.h:122
std::size_t operator()(const std::shared_ptr< Expression > &expression) const
Definition expression.h:123