14struct MatchBaseVisitor;
15struct ConstMatchBaseVisitor;
19namespace option_configs {
192 std::make_unique<storage::RowLayoutFactory>();
200 std::make_unique<storage::RowLayoutFactory>();
234#define M_WASM_OPERATOR_LIST_NON_TEMPLATED(X) \
236 X(LazyDisjunctiveFilter) \
238 X(HashBasedGrouping) \
243 X(HashBasedGroupJoin)
244#define M_WASM_OPERATOR_LIST_TEMPLATED(X) \
251 X(IndexScan<m::idx::IndexMethod::Array>) \
252 X(IndexScan<m::idx::IndexMethod::Rmi>) \
255 X(Quicksort<false>) \
257 X(NestedLoopsJoin<false>) \
258 X(NestedLoopsJoin<true>) \
259 X(SimpleHashJoin<M_COMMA(false) false>) \
260 X(SimpleHashJoin<M_COMMA(false) true>) \
261 X(SimpleHashJoin<M_COMMA(true) false>) \
262 X(SimpleHashJoin<M_COMMA(true) true>) \
263 X(SortMergeJoin<M_COMMA(false) M_COMMA(false) M_COMMA(false) false>) \
264 X(SortMergeJoin<M_COMMA(false) M_COMMA(false) M_COMMA(false) true>) \
265 X(SortMergeJoin<M_COMMA(false) M_COMMA(false) M_COMMA(true) false>) \
266 X(SortMergeJoin<M_COMMA(false) M_COMMA(false) M_COMMA(true) true>) \
267 X(SortMergeJoin<M_COMMA(false) M_COMMA(true) M_COMMA(false) false>) \
268 X(SortMergeJoin<M_COMMA(false) M_COMMA(true) M_COMMA(false) true>) \
269 X(SortMergeJoin<M_COMMA(false) M_COMMA(true) M_COMMA(true) false>) \
270 X(SortMergeJoin<M_COMMA(false) M_COMMA(true) M_COMMA(true) true>) \
271 X(SortMergeJoin<M_COMMA(true) M_COMMA(false) M_COMMA(false) false>) \
272 X(SortMergeJoin<M_COMMA(true) M_COMMA(false) M_COMMA(false) true>) \
273 X(SortMergeJoin<M_COMMA(true) M_COMMA(false) M_COMMA(true) false>) \
274 X(SortMergeJoin<M_COMMA(true) M_COMMA(false) M_COMMA(true) true>) \
275 X(SortMergeJoin<M_COMMA(true) M_COMMA(true) M_COMMA(false) false>) \
276 X(SortMergeJoin<M_COMMA(true) M_COMMA(true) M_COMMA(false) true>) \
277 X(SortMergeJoin<M_COMMA(true) M_COMMA(true) M_COMMA(true) false>) \
278 X(SortMergeJoin<M_COMMA(true) M_COMMA(true) M_COMMA(true) true>)
279#define M_WASM_OPERATOR_LIST(X) \
280 M_WASM_OPERATOR_LIST_NON_TEMPLATED(X) \
281 M_WASM_OPERATOR_LIST_TEMPLATED(X)
284#define MAKE_WASM_MATCH_(OP) m::Match<m::wasm::OP>
285#define M_WASM_MATCH_LIST_NON_TEMPLATED(X) M_TRANSFORM_X_MACRO(X, M_WASM_OPERATOR_LIST_NON_TEMPLATED, MAKE_WASM_MATCH_)
286#define M_WASM_MATCH_LIST_TEMPLATED(X) \
287 X(m::Match<m::wasm::Callback<false>>) \
288 X(m::Match<m::wasm::Callback<true>>) \
289 X(m::Match<m::wasm::Print<false>>) \
290 X(m::Match<m::wasm::Print<true>>) \
291 X(m::Match<m::wasm::Scan<false>>) \
292 X(m::Match<m::wasm::Scan<true>>) \
293 X(m::Match<m::wasm::IndexScan<m::idx::IndexMethod::Array>>) \
294 X(m::Match<m::wasm::IndexScan<m::idx::IndexMethod::Rmi>>) \
295 X(m::Match<m::wasm::Filter<false>>) \
296 X(m::Match<m::wasm::Filter<true>>) \
297 X(m::Match<m::wasm::Quicksort<false>>) \
298 X(m::Match<m::wasm::Quicksort<true>>) \
299 X(m::Match<m::wasm::NestedLoopsJoin<false>>) \
300 X(m::Match<m::wasm::NestedLoopsJoin<true>>) \
301 X(m::Match<m::wasm::SimpleHashJoin<M_COMMA(false) false>>) \
302 X(m::Match<m::wasm::SimpleHashJoin<M_COMMA(false) true>>) \
303 X(m::Match<m::wasm::SimpleHashJoin<M_COMMA(true) false>>) \
304 X(m::Match<m::wasm::SimpleHashJoin<M_COMMA(true) true>>) \
305 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(false) M_COMMA(false) M_COMMA(false) false>>) \
306 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(false) M_COMMA(false) M_COMMA(false) true>>) \
307 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(false) M_COMMA(false) M_COMMA(true) false>>) \
308 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(false) M_COMMA(false) M_COMMA(true) true>>) \
309 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(false) M_COMMA(true) M_COMMA(false) false>>) \
310 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(false) M_COMMA(true) M_COMMA(false) true>>) \
311 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(false) M_COMMA(true) M_COMMA(true) false>>) \
312 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(false) M_COMMA(true) M_COMMA(true) true>>) \
313 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(true) M_COMMA(false) M_COMMA(false) false>>) \
314 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(true) M_COMMA(false) M_COMMA(false) true>>) \
315 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(true) M_COMMA(false) M_COMMA(true) false>>) \
316 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(true) M_COMMA(false) M_COMMA(true) true>>) \
317 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(true) M_COMMA(true) M_COMMA(false) false>>) \
318 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(true) M_COMMA(true) M_COMMA(false) true>>) \
319 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(true) M_COMMA(true) M_COMMA(true) false>>) \
320 X(m::Match<m::wasm::SortMergeJoin<M_COMMA(true) M_COMMA(true) M_COMMA(true) true>>)
321#define M_WASM_MATCH_LIST(X) \
322 M_WASM_MATCH_LIST_NON_TEMPLATED(X) \
323 M_WASM_MATCH_LIST_TEMPLATED(X)
327 namespace wasm { struct OP; } \
328 template<> struct Match<wasm::OP>;
332namespace wasm {
template<
bool SIMDfied>
struct Callback; }
333template<
bool SIMDfied>
struct Match<
wasm::Callback<SIMDfied>>;
335namespace
wasm {
template<
bool SIMDfied>
struct Print; }
336template<
bool SIMDfied>
struct Match<
wasm::Print<SIMDfied>>;
338namespace
wasm {
template<
bool SIMDfied>
struct Scan; }
339template<
bool SIMDfied>
struct Match<
wasm::Scan<SIMDfied>>;
341namespace
wasm {
template<
idx::IndexMethod IndexMethod>
struct IndexScan; }
342template<
idx::IndexMethod IndexMethod>
struct Match<
wasm::IndexScan<IndexMethod>>;
344namespace
wasm {
template<
bool Predicated>
struct Filter; }
345template<
bool Predicated>
struct Match<
wasm::Filter<Predicated>>;
347namespace
wasm {
template<
bool CmpPredicated>
struct Quicksort; }
348template<
bool CmpPredicated>
struct Match<
wasm::Quicksort<CmpPredicated>>;
350namespace
wasm {
template<
bool Predicated>
struct NestedLoopsJoin; }
351template<
bool Predicated>
struct Match<
wasm::NestedLoopsJoin<Predicated>>;
353namespace
wasm {
template<
bool UniqueBuild,
bool Predicated>
struct SimpleHashJoin; }
354template<
bool UniqueBuild,
bool Predicated>
struct Match<
wasm::SimpleHashJoin<UniqueBuild, Predicated>>;
356namespace
wasm {
template<
bool SortLeft,
bool SortRight,
bool Predicated,
bool CmpPredicated>
struct SortMergeJoin; }
357template<
bool SortLeft,
bool SortRight,
bool Predicated,
bool CmpPredicated>
358struct Match<
wasm::SortMergeJoin<SortLeft, SortRight, Predicated, CmpPredicated>>;
369template<
bool SIMDfied>
374 static ConditionSet pre_condition(std::size_t child_idx,
375 const std::tuple<const CallbackOperator*> &partial_inner_nodes);
378template<
bool SIMDfied>
383 static ConditionSet pre_condition(std::size_t child_idx,
384 const std::tuple<const PrintOperator*> &partial_inner_nodes);
387template<
bool SIMDfied>
392 static ConditionSet pre_condition(std::size_t child_idx,
393 const std::tuple<const ScanOperator*> &partial_inner_nodes);
397template<
idx::IndexMethod IndexMethod>
402 static ConditionSet pre_condition(std::size_t child_idx,
403 const std::tuple<const FilterOperator*, const ScanOperator*> &partial_inner_nodes);
407template<
bool Predicated>
412 static ConditionSet pre_condition(std::size_t child_idx,
413 const std::tuple<const FilterOperator*> &partial_inner_nodes);
421 static ConditionSet pre_condition(std::size_t child_idx,
422 const std::tuple<const FilterOperator*> &partial_inner_nodes);
429 static ConditionSet pre_condition(std::size_t child_idx,
430 const std::tuple<const ProjectionOperator*> &partial_inner_nodes);
438 static ConditionSet pre_condition(std::size_t child_idx,
439 const std::tuple<const GroupingOperator*> &partial_inner_nodes);
446 template<
bool IsGlobal,
typename T>
448 template<
bool IsGlobal>
451 std::pair<var_t_<IsGlobal, I8x1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
452 std::pair<var_t_<IsGlobal, I16x1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
453 std::pair<var_t_<IsGlobal, I32x1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
454 std::pair<var_t_<IsGlobal, I64x1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
455 std::pair<var_t_<IsGlobal, Floatx1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
456 std::pair<var_t_<IsGlobal, Doublex1>, std::optional<var_t_<IsGlobal, Boolx1>>>
458 template<
bool IsGlobal>
461 std::pair<var_t_<IsGlobal, Boolx1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
462 std::pair<var_t_<IsGlobal, I8x1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
463 std::pair<var_t_<IsGlobal, I16x1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
464 std::pair<var_t_<IsGlobal, I32x1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
465 std::pair<var_t_<IsGlobal, I64x1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
466 std::pair<var_t_<IsGlobal, Floatx1>, std::optional<var_t_<IsGlobal, Boolx1>>>,
467 std::pair<var_t_<IsGlobal, Doublex1>, std::optional<var_t_<IsGlobal, Boolx1>>>
473 static ConditionSet pre_condition(std::size_t child_idx,
474 const std::tuple<const GroupingOperator*> &partial_inner_nodes);
481 template<
bool IsGlobal,
typename T>
483 template<
bool IsGlobal, std::
size_t L>
497 static ConditionSet pre_condition(std::size_t child_idx,
498 const std::tuple<const AggregationOperator*> &partial_inner_nodes);
502template<
bool CmpPredicated>
507 static ConditionSet pre_condition(std::size_t child_idx,
508 const std::tuple<const SortingOperator*> &partial_inner_nodes);
516 static ConditionSet pre_condition(std::size_t child_idx,
517 const std::tuple<const SortingOperator*> &partial_inner_nodes);
520template<
bool Predicated>
525 static ConditionSet pre_condition(std::size_t child_idx,
const std::tuple<const JoinOperator*> &partial_inner_nodes);
528 std::vector<std::reference_wrapper<const ConditionSet>> &&post_cond_children);
531template<
bool UniqueBuild,
bool Predicated>
533 :
PhysicalOperator<SimpleHashJoin<UniqueBuild, Predicated>, pattern_t<JoinOperator, Wildcard, Wildcard>>
538 pre_condition(std::size_t child_idx,
539 const std::tuple<const JoinOperator*, const Wildcard*, const Wildcard*> &partial_inner_nodes);
542 std::vector<std::reference_wrapper<const ConditionSet>> &&post_cond_children);
545template<
bool SortLeft,
bool SortRight,
bool Predicated,
bool CmpPredicated>
547 :
PhysicalOperator<SortMergeJoin<SortLeft, SortRight, Predicated, CmpPredicated>,
548 pattern_t<JoinOperator, Wildcard, Wildcard>>
553 pre_condition(std::size_t child_idx,
554 const std::tuple<const JoinOperator*, const Wildcard*, const Wildcard*> &partial_inner_nodes);
557 std::vector<std::reference_wrapper<const ConditionSet>> &&post_cond_children);
564 static ConditionSet pre_condition(std::size_t child_idx,
565 const std::tuple<const LimitOperator*> &partial_inner_nodes);
569 :
PhysicalOperator<HashBasedGroupJoin, pattern_t<GroupingOperator, pattern_t<JoinOperator, Wildcard, Wildcard>>>
574 pre_condition(std::size_t child_idx,
575 const std::tuple<const GroupingOperator*, const JoinOperator*, const Wildcard*, const Wildcard*>
576 &partial_inner_nodes);
587 const std::unique_ptr<const storage::DataLayoutFactory> &buffer_factory,
590 if (buffer_factory) {
592 if (buffer_schema.num_entries()) {
595 buffer_num_tuples, std::move(setup), std::move(pipeline), std::move(teardown));
599 [&buffer](){ buffer.
consume(); },
604 T::execute(M, std::move(setup), std::move(pipeline), std::move(teardown));
607 T::execute(M, std::move(setup), std::move(pipeline), std::move(teardown));
616 virtual void accept(MatchBaseVisitor &v) = 0;
617 virtual void accept(ConstMatchBaseVisitor &v)
const = 0;
636 std::vector<unsharable_shared_ptr<const wasm::MatchBase>>
children;
640 std::vector<unsharable_shared_ptr<const wasm::MatchBase>>
res;
642 res.push_back(as<const wasm::MatchBase>(std::move(c)));
658 :
wasm::MatchSingleChild(
std::move(children))
668 void accept(wasm::MatchBaseVisitor &v)
override;
669 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
672 void print(std::ostream &out,
unsigned level)
const override;
675template<
bool SIMDfied>
679 std::unique_ptr<const storage::DataLayoutFactory> result_set_factory =
684 :
wasm::MatchSingleChild(
std::move(children))
685 , callback(*callback)
694 void accept(wasm::MatchBaseVisitor &v)
override;
695 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
698 void print(std::ostream &out,
unsigned level)
const override;
701template<
bool SIMDfied>
705 std::unique_ptr<const storage::DataLayoutFactory> result_set_factory =
710 :
wasm::MatchSingleChild(
std::move(children))
720 void accept(wasm::MatchBaseVisitor &v)
override;
721 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
724 void print(std::ostream &out,
unsigned level)
const override;
727template<
bool SIMDfied>
732 std::unique_ptr<const storage::DataLayoutFactory> buffer_factory_ =
735 : std::unique_ptr<storage::DataLayoutFactory>();
746 if (buffer_factory_) {
748 if (buffer_schema.num_entries()) {
751 std::move(setup), std::move(pipeline), std::move(teardown));
755 [&buffer](){ buffer.
consume(); },
771 void accept(wasm::MatchBaseVisitor &v)
override;
772 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
775 void print(std::ostream &out,
unsigned level)
const override;
778template<
idx::IndexMethod IndexMethod>
785 std::unique_ptr<const storage::DataLayoutFactory> buffer_factory_ =
788 : std::unique_ptr<storage::DataLayoutFactory>();
802 std::move(setup), std::move(pipeline), std::move(teardown));
807 void accept(wasm::MatchBaseVisitor &v)
override;
808 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
811 void print(std::ostream &out,
unsigned level)
const override;
814template<
bool Predicated>
819 std::unique_ptr<const storage::DataLayoutFactory> buffer_factory_ =
822 : std::unique_ptr<storage::DataLayoutFactory>();
827 :
wasm::MatchSingleChild(
std::move(children))
833 std::move(setup), std::move(pipeline), std::move(teardown));
838 void accept(wasm::MatchBaseVisitor &v)
override;
839 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
842 void print(std::ostream &out,
unsigned level)
const override;
850 std::unique_ptr<const storage::DataLayoutFactory> buffer_factory_ =
853 : std::unique_ptr<storage::DataLayoutFactory>();
858 :
wasm::MatchSingleChild(
std::move(children))
864 std::move(setup), std::move(pipeline), std::move(teardown));
869 void accept(wasm::MatchBaseVisitor &v)
override;
870 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
873 void print(std::ostream &out,
unsigned level)
const override;
880 std::optional<unsharable_shared_ptr<const wasm::MatchBase>>
child;
882 std::unique_ptr<const storage::DataLayoutFactory> buffer_factory_ =
885 : std::unique_ptr<storage::DataLayoutFactory>();
890 : projection(*projection)
892 if (not children.empty()) {
894 child = as<const wasm::MatchBase>(std::move(children[0]));
900 std::move(setup), std::move(pipeline), std::move(teardown));
905 void accept(wasm::MatchBaseVisitor &v)
override;
906 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
909 void print(std::ostream &out,
unsigned level)
const override;
916 bool use_open_addressing_hashing =
924 :
wasm::MatchSingleChild(
std::move(children))
925 , grouping(*grouping)
934 void accept(wasm::MatchBaseVisitor &v)
override;
935 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
938 void print(std::ostream &out,
unsigned level)
const override;
947 :
wasm::MatchSingleChild(
std::move(children))
948 , grouping(*grouping)
957 void accept(wasm::MatchBaseVisitor &v)
override;
958 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
961 void print(std::ostream &out,
unsigned level)
const override;
970 :
wasm::MatchSingleChild(
std::move(children))
971 , aggregation(*aggregation)
980 void accept(wasm::MatchBaseVisitor &v)
override;
981 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
984 void print(std::ostream &out,
unsigned level)
const override;
987template<
bool CmpPredicated>
991 std::unique_ptr<const storage::DataLayoutFactory> materializing_factory =
995 :
wasm::MatchSingleChild(
std::move(children))
1005 void accept(wasm::MatchBaseVisitor &v)
override;
1006 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
1009 void print(std::ostream &out,
unsigned level)
const override;
1018 :
wasm::MatchSingleChild(
std::move(children))
1028 void accept(wasm::MatchBaseVisitor &v)
override;
1029 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
1032 void print(std::ostream &out,
unsigned level)
const override;
1035template<
bool Predicated>
1041 std::unique_ptr<const storage::DataLayoutFactory> buffer_factory_ =
1044 : std::unique_ptr<storage::DataLayoutFactory>();
1049 :
wasm::MatchMultipleChildren(
std::move(children))
1052 for (std::size_t i = 0; i < children.size() - 1; ++i)
1058 std::move(setup), std::move(pipeline), std::move(teardown));
1063 void accept(wasm::MatchBaseVisitor &v)
override;
1064 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
1067 void print(std::ostream &out,
unsigned level)
const override;
1070template<
bool UniqueBuild,
bool Predicated>
1076 bool use_open_addressing_hashing =
1080 double load_factor =
1083 std::unique_ptr<const storage::DataLayoutFactory> buffer_factory_ =
1086 : std::unique_ptr<storage::DataLayoutFactory>();
1092 :
wasm::MatchMultipleChildren(
std::move(children))
1102 std::move(setup), std::move(pipeline), std::move(teardown));
1107 void accept(wasm::MatchBaseVisitor &v)
override;
1108 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
1111 void print(std::ostream &out,
unsigned level)
const override;
1114template<
bool SortLeft,
bool SortRight,
bool Predicated,
bool CmpPredicated>
1120 std::unique_ptr<const storage::DataLayoutFactory> left_materializing_factory =
1122 std::unique_ptr<const storage::DataLayoutFactory> right_materializing_factory =
1127 :
wasm::MatchMultipleChildren(
std::move(children))
1137 *
this, std::move(setup), std::move(pipeline), std::move(teardown)
1143 void accept(wasm::MatchBaseVisitor &v)
override;
1144 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
1147 void print(std::ostream &out,
unsigned level)
const override;
1156 :
wasm::MatchSingleChild(
std::move(children))
1166 void accept(wasm::MatchBaseVisitor &v)
override;
1167 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
1170 void print(std::ostream &out,
unsigned level)
const override;
1180 bool use_open_addressing_hashing =
1184 double load_factor =
1187 std::unique_ptr<const storage::DataLayoutFactory> buffer_factory_ =
1190 : std::unique_ptr<storage::DataLayoutFactory>();
1196 :
wasm::MatchMultipleChildren(
std::move(children))
1197 , grouping(*grouping)
1207 std::move(setup), std::move(pipeline), std::move(teardown));
1212 void accept(wasm::MatchBaseVisitor &v)
override;
1213 void accept(wasm::ConstMatchBaseVisitor &v)
const override;
1216 void print(std::ostream &out,
unsigned level)
const override;
1221#define M_WASM_VISITABLE_MATCH_LIST(X) \
1222 M_WASM_MATCH_LIST(X) \
1224 X(MatchSingleChild) \
1225 X(MatchMultipleChildren)
1234 using super = std::conditional_t<C, ConstMatchBaseVisitor, MatchBaseVisitor>;
1252 using super = std::conditional_t<C, ConstMatchBaseVisitor, MatchBaseVisitor>;
1263 using super = std::conditional_t<C, ConstMatchBaseVisitor, MatchBaseVisitor>;
1277#undef M_WASM_VISITABLE_MATCH_LIST
1282#define ACCEPT(CLASS) \
1283 inline void CLASS::accept(wasm::MatchBaseVisitor &v) { v(*this); } \
1284 inline void CLASS::accept(wasm::ConstMatchBaseVisitor &v) const { v(*this); }
1288#define ACCEPT(CLASS) \
1289 template<> inline void CLASS::accept(wasm::MatchBaseVisitor &v) { v(*this); } \
1290 template<> inline void CLASS::accept(wasm::ConstMatchBaseVisitor &v) const { v(*this); }
1298#define DECLARE(CLASS) \
1299 extern template struct m::wasm::CLASS; \
1300 extern template struct m::Match<m::wasm::CLASS>;
#define M_DECLARE_VISITOR(VISITOR_NAME, BASE_CLASS, CLASS_LIST)
Defines a visitor VISITOR_NAME to visit the class hierarchy rooted in BASE_CLASS and with subclasses ...
#define M_MAKE_STL_VISITABLE(VISITOR, BASE_CLASS, CLASS_LIST)
Defines a function visit() to make the class hierarchy STL-style visitable with VISITOR.
#define M_WASM_MATCH_LIST_NON_TEMPLATED(X)
#define M_WASM_OPERATOR_LIST_NON_TEMPLATED(X)
#define M_WASM_MATCH_LIST_TEMPLATED(X)
#define M_WASM_VISITABLE_MATCH_LIST(X)
#define M_WASM_OPERATOR_LIST_TEMPLATED(X)
#define M_CONSTEXPR_COND(COND, IF_TRUE, IF_FALSE)
IndexScanMaterializationStrategy
SoftPipelineBreakerStrategy
@ AFTER_NESTED_LOOPS_JOIN
@ AFTER_HASH_BASED_GROUP_JOIN
IndexScanCompilationStrategy
option_configs::SoftPipelineBreakerStrategy soft_pipeline_breaker
Where soft pipeline breakers should be added.
option_configs::OrderingStrategy simple_hash_join_ordering_strategy
Which ordering strategy should be used for wasm::SimpleHashJoin.
option_configs::JoinImplementation join_implementations
Which implementations should be considered for a JoinOperator.
option_configs::StoringStrategy hash_table_storing_strategy
Which storing strategy should be used for wasm::OpenAddressingHashTables.
option_configs::IndexScanStrategy index_scan_strategy
Which index scan strategy should be used for wasm::IndexScan.
option_configs::ScanImplementation scan_implementations
Which implementations should be considered for a ScanOperator.
std::optional< uint32_t > hash_table_initial_capacity
Which initial capacity should be used for wasm::HashTables.
option_configs::IndexScanMaterializationStrategy index_scan_materialization_strategy
Which materialization strategy should be used for wasm::IndexScan.
option_configs::SortingImplementation sorting_implementations
Which implementations should be considered for a SortingOperator.
std::vector< std::pair< m::Schema::Identifier, bool > > sorted_attributes
Which attributes are assumed to be sorted.
double load_factor_open_addressing
Which maximal load factor should be used for wasm::OpenAddressingHashTables.
std::size_t index_sequential_scan_batch_size
The number of results from index sequential scan to be communicated between host and v8 per batch.
bool exploit_unique_build
Whether to exploit uniqueness of build key in hash joins.
option_configs::SelectionStrategy nested_loops_join_selection_strategy
Which selection strategy should be used for wasm::NestedLoopsJoin.
option_configs::SelectionStrategy filter_selection_strategy
Which selection strategy should be used for wasm::Filter.
bool double_pumping
Whether to use double pumping if SIMDfication is enabled.
option_configs::SelectionStrategy sort_merge_join_selection_strategy
Which selection strategy should be used for wasm::SortMergeJoin.
std::size_t soft_pipeline_breaker_num_tuples
Which size in tuples should be used for soft pipeline breakers.
option_configs::ProbingStrategy hash_table_probing_strategy
Which probing strategy should be used for wasm::OpenAddressingHashTables.
option_configs::SelectionStrategy quicksort_cmp_selection_strategy
Which selection strategy should be used for comparisons in wasm::Quicksort.
bool hash_based_group_join
Whether to use wasm::HashBasedGroupJoin if possible.
std::size_t result_set_window_size
Which window size should be used for the result set.
bool simd
Whether to use SIMDfication.
option_configs::GroupingImplementation grouping_implementations
Which implementations should be considered for a GroupingOperator.
option_configs::IndexImplementation index_implementations
Which index implementations should be considered for an IndexScan.
std::size_t simd_lanes
Which number of SIMD lanes to prefer.
std::unique_ptr< const m::storage::DataLayoutFactory > hard_pipeline_breaker_layout
Which layout factory should be used for hard pipeline breakers.
option_configs::SelectionStrategy sort_merge_join_cmp_selection_strategy
Which selection strategy should be used for comparisons while sorting in wasm::SortMergeJoin.
double load_factor_chained
Which maximal load factor should be used for wasm::ChainedHashTables.
option_configs::IndexScanCompilationStrategy index_scan_compilation_strategy
Which compilation strategy should be used for wasm::IndexScan.
std::unique_ptr< const m::storage::DataLayoutFactory > soft_pipeline_breaker_layout
Which layout factory should be used for soft pipeline breakers.
option_configs::HashTableImplementation hash_table_implementation
Which implementation should be used for wasm::HashTables.
option_configs::SelectionStrategy simple_hash_join_selection_strategy
Which selection strategy should be used for wasm::SimpleHashJoin.
typename detail::var_helper< T >::type Var
Local variable.
for(std::size_t idx=1;idx< num_vectors;++idx) res.emplace((vectors_[idx].bitmask()<< uint32_t(idx *vector_type return * res
std::pair<::wasm::Expression *, std::list< std::shared_ptr< Bit > > > move()
Moves the underlying Binaryen ::wasm::Expression and the referenced bits out of this.
void execute_buffered(const Match< T > &M, const Schema &schema, const std::unique_ptr< const storage::DataLayoutFactory > &buffer_factory, std::size_t buffer_num_tuples, setup_t setup, pipeline_t pipeline, teardown_t teardown)
std::function< void(void)> pipeline_t
void register_wasm_operators(PhysicalOptimizer &phys_opt)
Registers physical Wasm operators in phys_opt depending on the set CLI options.
command-line options for the HeuristicSearchPlanEnumerator
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
Match(const AggregationOperator *aggregation, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::MatchBaseVisitor &v) override
void accept(wasm::ConstMatchBaseVisitor &v) const override
void print(std::ostream &out, unsigned level) const override
const AggregationOperator & aggregation
const CallbackOperator & callback
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void accept(wasm::ConstMatchBaseVisitor &v) const override
void accept(wasm::MatchBaseVisitor &v) override
Match(const CallbackOperator *callback, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void print(std::ostream &out, unsigned level) const override
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
Match(const FilterOperator *filter, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void accept(wasm::MatchBaseVisitor &v) override
void print(std::ostream &out, unsigned level) const override
const FilterOperator & filter
void accept(wasm::ConstMatchBaseVisitor &v) const override
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::ConstMatchBaseVisitor &v) const override
void accept(wasm::MatchBaseVisitor &v) override
void print(std::ostream &out, unsigned level) const override
const GroupingOperator & grouping
const JoinOperator & join
Match(const GroupingOperator *grouping, const JoinOperator *join, const Wildcard *build, const Wildcard *probe, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
Match(const GroupingOperator *grouping, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
const GroupingOperator & grouping
void print(std::ostream &out, unsigned level) const override
void accept(wasm::ConstMatchBaseVisitor &v) const override
void accept(wasm::MatchBaseVisitor &v) override
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void print(std::ostream &out, unsigned level) const override
const ScanOperator & scan
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::MatchBaseVisitor &v) override
Match(const FilterOperator *filter, const ScanOperator *scan, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
const FilterOperator & filter
void accept(wasm::ConstMatchBaseVisitor &v) const override
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void print(std::ostream &out, unsigned level) const override
void accept(wasm::MatchBaseVisitor &v) override
Match(const DisjunctiveFilterOperator *filter, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
const DisjunctiveFilterOperator & filter
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void accept(wasm::ConstMatchBaseVisitor &v) const override
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
const LimitOperator & limit
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
Match(const LimitOperator *limit, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void accept(wasm::ConstMatchBaseVisitor &v) const override
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void accept(wasm::MatchBaseVisitor &v) override
void print(std::ostream &out, unsigned level) const override
const JoinOperator & join
Match(const JoinOperator *join, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void accept(wasm::ConstMatchBaseVisitor &v) const override
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
std::vector< std::unique_ptr< const storage::DataLayoutFactory > > materializing_factories_
void accept(wasm::MatchBaseVisitor &v) override
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void print(std::ostream &out, unsigned level) const override
Match(const SortingOperator *sorting, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::MatchBaseVisitor &v) override
void print(std::ostream &out, unsigned level) const override
void accept(wasm::ConstMatchBaseVisitor &v) const override
const SortingOperator & sorting
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::MatchBaseVisitor &v) override
void accept(wasm::ConstMatchBaseVisitor &v) const override
Match(const NoOpOperator *noop, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void print(std::ostream &out, unsigned level) const override
const NoOpOperator & noop
void accept(wasm::MatchBaseVisitor &v) override
Match(const GroupingOperator *grouping, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void print(std::ostream &out, unsigned level) const override
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::ConstMatchBaseVisitor &v) const override
const GroupingOperator & grouping
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
Match(const PrintOperator *print, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void accept(wasm::MatchBaseVisitor &v) override
const PrintOperator & print_op
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void print(std::ostream &out, unsigned level) const override
void accept(wasm::ConstMatchBaseVisitor &v) const override
Match(const ProjectionOperator *projection, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void print(std::ostream &out, unsigned level) const override
void accept(wasm::ConstMatchBaseVisitor &v) const override
const ProjectionOperator & projection
std::optional< unsharable_shared_ptr< const wasm::MatchBase > > child
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::MatchBaseVisitor &v) override
Match(const SortingOperator *sorting, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void print(std::ostream &out, unsigned level) const override
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::MatchBaseVisitor &v) override
const SortingOperator & sorting
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void accept(wasm::ConstMatchBaseVisitor &v) const override
const ScanOperator & scan
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
Match(const ScanOperator *scan, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void accept(wasm::MatchBaseVisitor &v) override
void print(std::ostream &out, unsigned level) const override
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::ConstMatchBaseVisitor &v) const override
Match(const JoinOperator *join, const Wildcard *build, const Wildcard *probe, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void print(std::ostream &out, unsigned level) const override
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void accept(wasm::ConstMatchBaseVisitor &v) const override
void accept(wasm::MatchBaseVisitor &v) override
const JoinOperator & join
void accept(wasm::ConstMatchBaseVisitor &v) const override
const JoinOperator & join
const Operator & get_matched_root() const override
Returns the matched logical root operator for physical operators.
void execute(setup_t setup, pipeline_t pipeline, teardown_t teardown) const override
Executes this physical operator match.
void accept(wasm::MatchBaseVisitor &v) override
const Wildcard & parent
the referenced relation with unique join attributes
const Wildcard & child
the relation referencing the parent relation
Match(const JoinOperator *join, const Wildcard *parent, const Wildcard *child, std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
void print(std::ostream &out, unsigned level) const override
Drops the produced results and outputs only the number of result tuples produced.
An Operator represents an operation in a query plan.
Schema & schema()
Returns the Schema of this Operator.
The physical optimizer interface.
Prints the produced Tuples to a std::ostream instance.
A Producer is an Operator that can be evaluated to a sequence of tuples.
A Schema represents a sequence of identifiers, optionally with a prefix, and their associated types.
Schema deduplicate() const
Returns a deduplicated version of this Schema, i.e.
Schema drop_constants() const
Returns a copy of this Schema where all constant entries are removed.
static setup_t Make_Without_Parent(base_t &&callback=base_t())
static teardown_t Make_Without_Parent(base_t &&callback=base_t())
This class extends std::shared_ptr to allow for unsharing an exclusively held object and thereby conv...
static double cost(const Match< Aggregation > &)
std::conditional_t< IsGlobal, Global< T >, Var< T > > var_t_
static void execute(const Match< Aggregation > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
std::variant< var_t_< IsGlobal, I64< L > >, std::pair< var_t_< IsGlobal, I8< L > >, var_t_< IsGlobal, Bool< L > > >, std::pair< var_t_< IsGlobal, I16< L > >, var_t_< IsGlobal, Bool< L > > >, std::pair< var_t_< IsGlobal, I32< L > >, var_t_< IsGlobal, Bool< L > > >, std::pair< var_t_< IsGlobal, I64< L > >, var_t_< IsGlobal, Bool< L > > >, std::pair< var_t_< IsGlobal, Float< L > >, var_t_< IsGlobal, Bool< L > > >, std::pair< var_t_< IsGlobal, Double< L > >, var_t_< IsGlobal, Bool< L > > > > agg_t_
Buffers tuples by materializing them into memory.
void resume_pipeline(param_t tuple_value_schema=param_t(), param_t tuple_addr_schema=param_t()) const
Emits code into a separate function to resume the pipeline for each value tuple of schema tuple_value...
void consume()
Emits code to store the current tuple into the buffer.
void setup()
Performs the setup of all local variables of this buffer (by reading them from the global backups iff...
void teardown()
Performs the teardown of all local variables of this buffer (by storing them into the global backups ...
static double cost(const Match< Callback > &)
static void execute(const Match< Callback > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
static CodeGenContext & Get()
static void execute(const Match< HashBasedGrouping > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
static void execute(const Match< Limit > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
static double cost(const Match< Limit > &)
An abstract MatchBase for the WasmV8 backend.
virtual void accept(MatchBaseVisitor &v)=0
virtual void accept(ConstMatchBaseVisitor &v) const =0
Intermediate match type for leaves, i.e.
Intermediate match type for physical operator matches with multiple children.
std::vector< unsharable_shared_ptr< const wasm::MatchBase > > children
MatchMultipleChildren(std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
Intermediate match type for physical operator matches with a single child.
unsharable_shared_ptr< const wasm::MatchBase > child
MatchSingleChild(std::vector< unsharable_shared_ptr< const m::MatchBase > > &&children)
static void execute(const Match< NoOpSorting > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
static double cost(const Match< NoOpSorting > &)
static void execute(const Match< NoOp > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
static double cost(const Match< NoOp > &)
std::variant< var_t_< IsGlobal, I64x1 >, std::pair< var_t_< IsGlobal, I8x1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, I16x1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, I32x1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, I64x1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, Floatx1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, Doublex1 >, std::optional< var_t_< IsGlobal, Boolx1 > > > > agg_t_
std::variant< var_t_< IsGlobal, Ptr< Charx1 > >, std::pair< var_t_< IsGlobal, Boolx1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, I8x1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, I16x1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, I32x1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, I64x1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, Floatx1 >, std::optional< var_t_< IsGlobal, Boolx1 > > >, std::pair< var_t_< IsGlobal, Doublex1 >, std::optional< var_t_< IsGlobal, Boolx1 > > > > key_t_
static void execute(const Match< OrderedGrouping > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
std::conditional_t< IsGlobal, Global< T >, Var< T > > var_t_
static double cost(const Match< Print > &)
static void execute(const Match< Print > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
static double cost(const Match< Projection > &)
static double cost(const Match< Quicksort > &)
static void execute(const Match< Quicksort > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
static double cost(const Match< Scan > &)
static void execute(const Match< Scan > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
static void execute(const Match< SortMergeJoin > &M, setup_t setup, pipeline_t pipeline, teardown_t teardown)
std::conditional_t< C, ConstMatchBaseVisitor, MatchBaseVisitor > super
void operator()(Const< MatchBase > &)
typename super::template Const< T > Const
virtual ~ThePostOrderMatchBaseVisitor()
typename super::template Const< T > Const
void operator()(Const< MatchBase > &)
std::conditional_t< C, ConstMatchBaseVisitor, MatchBaseVisitor > super
virtual ~ThePreOrderMatchBaseVisitor()
A generic base class for implementing recursive wasm::MatchBase visitors.
virtual ~TheRecursiveMatchBaseVisitorBase()
std::conditional_t< C, ConstMatchBaseVisitor, MatchBaseVisitor > super
void operator()(Const< MatchMultipleChildren > &M) override
void operator()(Const< Match< Projection > > &M) override
void operator()(Const< MatchBase > &M) override
typename super::template Const< T > Const
void operator()(Const< MatchLeaf > &) override
void operator()(Const< MatchSingleChild > &M) override