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);
65 for (
size_t i = 0; i < rel_alg_node->
inputCount(); ++i) {
88 visit(outer_condition);
94 for (
size_t row_idx = 0; row_idx < rel_logical_values->
getNumRows(); ++row_idx) {
95 for (
size_t col_idx = 0; col_idx < rel_logical_values->
getRowsSize(); ++col_idx) {
102 for (
size_t i = 0; i < rel_projection->
size(); ++i) {
127 static_assert(std::is_trivially_destructible_v<decltype(handlers)>);
129 auto const& type_index = std::type_index(
typeid(*rex_scalar));
130 auto const itr =
std::lower_bound(handlers.cbegin(), handlers.cend(), type_index);
131 if (itr != handlers.cend() && itr->type_index == type_index) {
132 (this->*itr->handler)(rex_scalar);
140 for (
const auto& partition_key : rex_window_function_operator->
getPartitionKeys()) {
141 visit(partition_key.get());
143 for (
const auto& order_key : rex_window_function_operator->
getOrderKeys()) {
144 visit(order_key.get());
149 for (
size_t i = 0; i < rex_case->
branchCount(); ++i) {
159 for (
size_t i = 0; i < rex_function_operator->
size(); ++i) {
165 for (
size_t i = 0; i < rex_operator->
size(); ++i) {
171 visit(rex_sub_query->getRelAlg());
const ConstRexScalarPtrVector & getPartitionKeys() const
DEVICE void sort(ARGS &&... args)
void visit(RelAlgNode const *)
size_t size() const override
const RexScalar * getProjectAt(const size_t idx) const
const ConstRexScalarPtrVector & getOrderKeys() const
size_t branchCount() const
const RexScalar * getTableFuncInputAt(const size_t idx) const
std::array< TypeHandler< RelRexDagVisitor, T >, N > Handlers
const RexScalar * getCondition() const
const RexScalar * getWhen(const size_t idx) const
DEVICE auto lower_bound(ARGS &&... args)
const RexScalar * getThen(const size_t idx) const
static Handlers< T, sizeof...(Ts)> make_handlers()
const RexScalar * getInnerCondition() const
const RexScalar * getOperand(const size_t idx) const
const RexScalar * getOuterCondition(const size_t nesting_level) const
const RexScalar * getCondition() const
const size_t inputCount() const
virtual std::string toString() const =0
const RexScalar * getValueAt(const size_t row_idx, const size_t col_idx) const
const RexScalar * getFilterExpr() const
virtual std::string toString() const =0
const RelAlgNode * getInput(const size_t idx) const
size_t getRowsSize() const
size_t getTableFuncInputsSize() const
size_t getNumRows() const
const RexScalar * getElse() const