Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions r/src/compute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ std::shared_ptr<arrow::compute::FunctionOptions> make_compute_options(
max_replacements);
}

if (func_name == "extract_regex") {
using Options = arrow::compute::ExtractRegexOptions;
return std::make_shared<Options>(cpp11::as_cpp<std::string>(options["pattern"]));
}

if (func_name == "day_of_week") {
using Options = arrow::compute::DayOfWeekOptions;
bool one_based_numbering = true;
Expand Down
8 changes: 8 additions & 0 deletions r/tests/testthat/test-compute-no-bindings.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,11 @@ test_that("non-bound compute kernels using MatchSubstringOptions", {
c(0, 0, 1, 1)
)
})

test_that("non-bound compute kernels using ExtractRegexOptions", {
skip_if_not_available("re2")
expect_equal(
call_function("extract_regex", Scalar$create("abracadabra"), options = list(pattern = "(?P<letter>[a])")),
Scalar$create(tibble::tibble(letter = "a"))
)
})