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: "
69 if (
cache_.emplace(static_cast<Cache::value_type>(rel_alg_node)).second) {
71 for (
size_t i = 0; i < rel_alg_node->
inputCount(); ++i) {
96 for (
size_t level = 1; level < rel_left_deep_inner_join->
inputCount(); ++level) {
98 visit(outer_condition);
104 for (
size_t row_idx = 0; row_idx < rel_logical_values->
getNumRows(); ++row_idx) {
105 for (
size_t col_idx = 0; col_idx < rel_logical_values->
getRowsSize(); ++col_idx) {
112 for (
size_t i = 0; i < rel_projection->
size(); ++i) {
127 visit(outer_join_condition);
144 static_assert(std::is_trivially_destructible_v<decltype(handlers)>);
145 if (
cache_.emplace(static_cast<Cache::value_type>(rex_scalar)).second) {
147 auto const& type_index = std::type_index(
typeid(*rex_scalar));
148 auto const itr =
std::lower_bound(handlers.cbegin(), handlers.cend(), type_index);
149 if (itr != handlers.cend() && itr->type_index == type_index) {
150 (this->*itr->handler)(rex_scalar);
152 LOG(
FATAL) <<
"Unhandled RexScalar type: "
160 for (
const auto& partition_key : rex_window_function_operator->
getPartitionKeys()) {
161 visit(partition_key.get());
163 for (
const auto& order_key : rex_window_function_operator->
getOrderKeys()) {
164 visit(order_key.get());
169 for (
size_t i = 0; i < rex_case->
branchCount(); ++i) {
179 for (
size_t i = 0; i < rex_function_operator->
size(); ++i) {
185 for (
size_t i = 0; i < rex_operator->
size(); ++i) {
191 visit(rex_sub_query->getRelAlg());
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
static Handlers< T, sizeof...(Ts)> make_handlers()
size_t branchCount() const
const RelAlgNode * getInput(const size_t idx) const
size_t getTableFuncInputsSize() const
virtual std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const =0
const RexScalar * getProjectAt(const size_t idx) const
const ConstRexScalarPtrVector & getPartitionKeys() const
virtual std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const =0
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