31 template <
typename T,
typename... Ts>
34 {{std::type_index(
typeid(Ts)), &RelRexDagVisitor::cast<T, Ts>}...}};
35 std::sort(handlers.begin(), handlers.end());
56 static_assert(std::is_trivially_destructible_v<decltype(handlers)>);
58 auto const& type_index = std::type_index(
typeid(*rel_alg_node));
59 auto const itr =
std::lower_bound(handlers.cbegin(), handlers.cend(), type_index);
60 if (itr != handlers.cend() && itr->type_index == type_index) {
61 (this->*itr->handler)(rel_alg_node);
63 LOG(
FATAL) <<
"Unhandled RelAlgNode type: "
70 for (
size_t i = 0; i < rel_alg_node->
inputCount(); ++i) {
94 for (
size_t level = 1; level < rel_left_deep_inner_join->
inputCount(); ++level) {
96 visit(outer_condition);
102 for (
size_t row_idx = 0; row_idx < rel_logical_values->
getNumRows(); ++row_idx) {
103 for (
size_t col_idx = 0; col_idx < rel_logical_values->
getRowsSize(); ++col_idx) {
110 for (
size_t i = 0; i < rel_projection->
size(); ++i) {
125 visit(outer_join_condition);
142 static_assert(std::is_trivially_destructible_v<decltype(handlers)>);
144 auto const& type_index = std::type_index(
typeid(*rex_scalar));
145 auto const itr =
std::lower_bound(handlers.cbegin(), handlers.cend(), type_index);
146 if (itr != handlers.cend() && itr->type_index == type_index) {
147 (this->*itr->handler)(rex_scalar);
149 LOG(
FATAL) <<
"Unhandled RexScalar type: "
156 for (
const auto& partition_key : rex_window_function_operator->
getPartitionKeys()) {
157 visit(partition_key.get());
159 for (
const auto& order_key : rex_window_function_operator->
getOrderKeys()) {
160 visit(order_key.get());
165 for (
size_t i = 0; i < rex_case->
branchCount(); ++i) {
175 for (
size_t i = 0; i < rex_function_operator->
size(); ++i) {
181 for (
size_t i = 0; i < rex_operator->
size(); ++i) {
187 visit(rex_sub_query->getRelAlg());
virtual std::string toString(RelRexToStringConfig config) const =0
const RexScalar * getThen(const size_t idx) const
virtual void visit(RelAlgNode const *)
size_t size() const override
const RexScalar * getFilterExpr() const
const RexScalar * getElse() const
const RexScalar * getOuterCondition(const size_t nesting_level) const
const RexScalar * getOperand(const size_t idx) const
size_t getNumRows() const
const RexScalar * getCondition() const
DEVICE void sort(ARGS &&...args)
const RexScalar * getWhen(const size_t idx) const
const RexScalar * getCondition() const
std::array< TypeHandler< RelRexDagVisitor, T >, N > Handlers
size_t getRowsSize() const
const size_t getScalarSourcesSize() const
const RelAlgNode * getRHS() const
virtual std::string toString(RelRexToStringConfig config) const =0
static Handlers< T, sizeof...(Ts)> make_handlers()
size_t branchCount() const
const RelAlgNode * getInput(const size_t idx) const
size_t getTableFuncInputsSize() const
const RexScalar * getProjectAt(const size_t idx) const
const ConstRexScalarPtrVector & getPartitionKeys() const
const RelAlgNode * getLHS() const
DEVICE auto lower_bound(ARGS &&...args)
const RexScalar * getOuterJoinCond() const
static RelRexToStringConfig defaults()
void castAndVisit(RelAlgNode const *)
const RexScalar * getTableFuncInputAt(const size_t idx) const
const RexScalar * getValueAt(const size_t row_idx, const size_t col_idx) const
const RexScalar * getInnerCondition() const
const ConstRexScalarPtrVector & getOrderKeys() const
const size_t inputCount() const
const RexScalar * getScalarSource(const size_t i) const