Skip to content

Commit

Permalink
[Wasm] Add CLI argument to choose indexes for IndexScan
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelmaltry authored and lucagretscher committed Oct 31, 2024
1 parent 80cbdbd commit a2b1bd4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/backend/WasmOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ static void add_wasm_operator_args()
}
}
);
C.arg_parser().add<std::vector<std::string_view>>(
/* group= */ "Wasm",
/* short= */ nullptr,
/* long= */ "--index-implementations",
/* description= */ "a comma separated list of index implementations to consider for index scans (`Array`, or"
" `Rmi`)",
/* callback= */ [](std::vector<std::string_view> impls){
options::index_implementations = option_configs::IndexImplementation(0UL);
for (const auto &elem : impls) {
if (strneq(elem.data(), "Array", elem.size()))
options::index_implementations |= option_configs::IndexImplementation::ARRAY;
else if (strneq(elem.data(), "Rmi", elem.size()))
options::index_implementations |= option_configs::IndexImplementation::RMI;
else
std::cerr << "warning: ignore invalid index implementation " << elem << std::endl;
}
}
);
C.arg_parser().add<const char*>(
/* group= */ "Wasm",
/* short= */ nullptr,
Expand Down Expand Up @@ -534,8 +552,10 @@ void m::register_wasm_operators(PhysicalOptimizer &phys_opt)
phys_opt.register_operator<Scan<true>>();
}
if (bool(options::scan_implementations bitand option_configs::ScanImplementation::INDEX_SCAN)) {
phys_opt.register_operator<IndexScan<idx::IndexMethod::Array>>();
phys_opt.register_operator<IndexScan<idx::IndexMethod::Rmi>>();
if (bool(options::index_implementations bitand option_configs::IndexImplementation::ARRAY))
phys_opt.register_operator<IndexScan<idx::IndexMethod::Array>>();
if (bool(options::index_implementations bitand option_configs::IndexImplementation::RMI))
phys_opt.register_operator<IndexScan<idx::IndexMethod::Rmi>>();
}
if (bool(options::filter_selection_strategy bitand option_configs::SelectionStrategy::BRANCHING))
phys_opt.register_operator<Filter<false>>();
Expand Down
9 changes: 9 additions & 0 deletions src/backend/WasmOperator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ enum class JoinImplementation : uint64_t {
SORT_MERGE = 0b100,
};

enum class IndexImplementation : uint64_t {
ALL = 0b11,
ARRAY = 0b01,
RMI = 0b10,
};

enum class SoftPipelineBreakerStrategy : uint64_t {
AFTER_ALL = 0b1111111,
AFTER_SCAN = 0b0000001,
Expand Down Expand Up @@ -120,6 +126,9 @@ inline option_configs::SortingImplementation sorting_implementations = option_co
/** Which implementations should be considered for a `JoinOperator`. */
inline option_configs::JoinImplementation join_implementations = option_configs::JoinImplementation::ALL;

/** Which index implementations should be considered for an `IndexScan`. */
inline option_configs::IndexImplementation index_implementations = option_configs::IndexImplementation::ALL;

/** Which index scan strategy should be used for `wasm::IndexScan`. */
inline option_configs::IndexScanStrategy index_scan_strategy = option_configs::IndexScanStrategy::INTERPRETATION;

Expand Down

0 comments on commit a2b1bd4

Please sign in to comment.