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)
90 virtual std::unique_ptr<Expression>
copy()
const {
94 template<
class TARGET>
98 template<
class TARGET>
102 template<
class TARGET>
122 std::size_t
operator()(
const std::shared_ptr<Expression>& expression)
const {
123 return std::hash<std::string>{}(expression->getUniqueName());
129 const std::shared_ptr<Expression>& right)
const {
130 return left->getUniqueName() == right->getUniqueName();
#define KU_ASSERT(condition)
Definition assert.h:19
Definition expression.h:30
const TARGET * constPtrCast() const
Definition expression.h:103
bool operator==(const Expression &rhs) const
Definition expression.h:86
std::string uniqueName
Definition expression.h:116
std::string toString() const
Definition expression.h:88
expression_vector splitOnAND()
const common::LogicalType & getDataType() const
Definition expression.h:68
std::shared_ptr< Expression > getChild(common::idx_t idx) const
Definition expression.h:74
common::ExpressionType expressionType
Definition expression.h:111
const TARGET & constCast() const
Definition expression.h:99
uint32_t getNumChildren() const
Definition expression.h:73
void setAlias(const std::string &name)
Definition expression.h:57
std::string getUniqueName() const
Definition expression.h:60
expression_vector children
Definition expression.h:118
common::LogicalType & getDataTypeUnsafe()
Definition expression.h:67
virtual std::unique_ptr< Expression > copy() const
Definition expression.h:90
friend class ExpressionChildrenCollector
Definition expression.h:31
void setChild(common::idx_t idx, std::shared_ptr< Expression > child)
Definition expression.h:79
virtual ~Expression()=default
bool hasAlias() const
Definition expression.h:70
std::string getAlias() const
Definition expression.h:71
virtual std::string toStringInternal() const =0
expression_vector getChildren() const
Definition expression.h:78
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:59
virtual void cast(const common::LogicalType &type)
common::LogicalType dataType
Definition expression.h:112
std::string alias
Definition expression.h:117
TARGET & cast()
Definition expression.h:95
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:39
TO ku_dynamic_cast(FROM old)
Definition cast.h:11
ExpressionType
Definition expression_type.h:9
Definition alter_type.h:5
Definition expression.h:127
bool operator()(const std::shared_ptr< Expression > &left, const std::shared_ptr< Expression > &right) const
Definition expression.h:128
Definition expression.h:121
std::size_t operator()(const std::shared_ptr< Expression > &expression) const
Definition expression.h:122