Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming convention r_base::aggregate:: for aggregate functions, e.g. #95

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions duckdb-rfuns-r/R/aggregate.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
#' @rdname aggregate
#' @export
rfuns_sum <- function(x, ...) {
rfuns("aggregate", "sum", tibble(x = x), ...)
rfuns("aggregate::sum", tibble(x = x), ...)
}

#' @rdname aggregate
#' @export
rfuns_min <- function(x, ...) {
rfuns("aggregate", "min", tibble(x = x), ...)
rfuns("aggregate::min", tibble(x = x), ...)
}

#' @rdname aggregate
#' @export
rfuns_max <- function(x, ...) {
rfuns("aggregate", "max", tibble(x = x), ...)
rfuns("aggregate::max", tibble(x = x), ...)
}

6 changes: 3 additions & 3 deletions duckdb-rfuns-r/R/project.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' @export
rfuns_is.na <- function(x) {
rfuns("project", "is.na", tibble(x = x))
rfuns("is.na", tibble(x = x))
}

#' as.integer()
Expand All @@ -13,7 +13,7 @@ rfuns_is.na <- function(x) {
#'
#' @export
rfuns_as.integer <- function(x) {
rfuns("project", "as.integer", tibble(x = x))
rfuns("as.integer", tibble(x = x))
}

#' as.numeric()
Expand All @@ -22,5 +22,5 @@ rfuns_as.integer <- function(x) {
#'
#' @export
rfuns_as.numeric <- function(x) {
rfuns("project", "as.numeric", tibble(x = x))
rfuns("as.numeric", tibble(x = x))
}
8 changes: 7 additions & 1 deletion duckdb-rfuns-r/R/rfuns.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rfuns <- function(op = c("project", "aggregate"), fun, data, ..., error_call = caller_env()) {
rfuns <- function(fun, data, ..., error_call = caller_env()) {
withr::local_options(list(duckdb.materialize_message = FALSE))
con <- local_duckdb_con()

Expand All @@ -13,6 +13,12 @@ rfuns <- function(op = c("project", "aggregate"), fun, data, ..., error_call = c
)
)

op <- if (grepl("aggregate::", fun)) {
"aggregate"
} else {
"project"
}

result <- switch(op,
"project" = duckdb:::rel_project(in_rel, exprs),
"aggregate" = duckdb:::rel_aggregate(in_rel, list(), exprs)
Expand Down
4 changes: 2 additions & 2 deletions duckdb-rfuns-r/tests/testthat/_snaps/minmax.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Error in `rfuns_min()`:
! binding error
Caused by error:
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::min(VARCHAR, BOOLEAN)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::min(BOOLEAN, BOOLEAN) -> BOOLEAN\n\tr_base::min(BOOLEAN) -> BOOLEAN\n\tr_base::min(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::min(INTEGER) -> INTEGER\n\tr_base::min(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::min(DOUBLE) -> DOUBLE\n\tr_base::min(TIMESTAMP, BOOLEAN) -> TIMESTAMP\n\tr_base::min(TIMESTAMP) -> TIMESTAMP\n\tr_base::min(DATE, BOOLEAN) -> DATE\n\tr_base::min(DATE) -> DATE\n","name":"r_base::min","candidates":"r_base::min(BOOLEAN, BOOLEAN) -> BOOLEAN,r_base::min(BOOLEAN) -> BOOLEAN,r_base::min(INTEGER, BOOLEAN) -> INTEGER,r_base::min(INTEGER) -> INTEGER,r_base::min(DOUBLE, BOOLEAN) -> DOUBLE,r_base::min(DOUBLE) -> DOUBLE,r_base::min(TIMESTAMP, BOOLEAN) -> TIMESTAMP,r_base::min(TIMESTAMP) -> TIMESTAMP,r_base::min(DATE, BOOLEAN) -> DATE,r_base::min(DATE) -> DATE","call":"r_base::min(VARCHAR, BOOLEAN)","error_subtype":"NO_MATCHING_FUNCTION"}
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::aggregate::min(VARCHAR, BOOLEAN)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::aggregate::min(BOOLEAN, BOOLEAN) -> BOOLEAN\n\tr_base::aggregate::min(BOOLEAN) -> BOOLEAN\n\tr_base::aggregate::min(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::aggregate::min(INTEGER) -> INTEGER\n\tr_base::aggregate::min(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::aggregate::min(DOUBLE) -> DOUBLE\n\tr_base::aggregate::min(TIMESTAMP, BOOLEAN) -> TIMESTAMP\n\tr_base::aggregate::min(TIMESTAMP) -> TIMESTAMP\n\tr_base::aggregate::min(DATE, BOOLEAN) -> DATE\n\tr_base::aggregate::min(DATE) -> DATE\n","name":"r_base::aggregate::min","candidates":"r_base::aggregate::min(BOOLEAN, BOOLEAN) -> BOOLEAN,r_base::aggregate::min(BOOLEAN) -> BOOLEAN,r_base::aggregate::min(INTEGER, BOOLEAN) -> INTEGER,r_base::aggregate::min(INTEGER) -> INTEGER,r_base::aggregate::min(DOUBLE, BOOLEAN) -> DOUBLE,r_base::aggregate::min(DOUBLE) -> DOUBLE,r_base::aggregate::min(TIMESTAMP, BOOLEAN) -> TIMESTAMP,r_base::aggregate::min(TIMESTAMP) -> TIMESTAMP,r_base::aggregate::min(DATE, BOOLEAN) -> DATE,r_base::aggregate::min(DATE) -> DATE","call":"r_base::aggregate::min(VARCHAR, BOOLEAN)","error_subtype":"NO_MATCHING_FUNCTION"}

---

Expand All @@ -16,5 +16,5 @@
Error in `rfuns_max()`:
! binding error
Caused by error:
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::max(VARCHAR, BOOLEAN)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::max(BOOLEAN, BOOLEAN) -> BOOLEAN\n\tr_base::max(BOOLEAN) -> BOOLEAN\n\tr_base::max(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::max(INTEGER) -> INTEGER\n\tr_base::max(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::max(DOUBLE) -> DOUBLE\n\tr_base::max(TIMESTAMP, BOOLEAN) -> TIMESTAMP\n\tr_base::max(TIMESTAMP) -> TIMESTAMP\n\tr_base::max(DATE, BOOLEAN) -> DATE\n\tr_base::max(DATE) -> DATE\n","name":"r_base::max","candidates":"r_base::max(BOOLEAN, BOOLEAN) -> BOOLEAN,r_base::max(BOOLEAN) -> BOOLEAN,r_base::max(INTEGER, BOOLEAN) -> INTEGER,r_base::max(INTEGER) -> INTEGER,r_base::max(DOUBLE, BOOLEAN) -> DOUBLE,r_base::max(DOUBLE) -> DOUBLE,r_base::max(TIMESTAMP, BOOLEAN) -> TIMESTAMP,r_base::max(TIMESTAMP) -> TIMESTAMP,r_base::max(DATE, BOOLEAN) -> DATE,r_base::max(DATE) -> DATE","call":"r_base::max(VARCHAR, BOOLEAN)","error_subtype":"NO_MATCHING_FUNCTION"}
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::aggregate::max(VARCHAR, BOOLEAN)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::aggregate::max(BOOLEAN, BOOLEAN) -> BOOLEAN\n\tr_base::aggregate::max(BOOLEAN) -> BOOLEAN\n\tr_base::aggregate::max(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::aggregate::max(INTEGER) -> INTEGER\n\tr_base::aggregate::max(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::aggregate::max(DOUBLE) -> DOUBLE\n\tr_base::aggregate::max(TIMESTAMP, BOOLEAN) -> TIMESTAMP\n\tr_base::aggregate::max(TIMESTAMP) -> TIMESTAMP\n\tr_base::aggregate::max(DATE, BOOLEAN) -> DATE\n\tr_base::aggregate::max(DATE) -> DATE\n","name":"r_base::aggregate::max","candidates":"r_base::aggregate::max(BOOLEAN, BOOLEAN) -> BOOLEAN,r_base::aggregate::max(BOOLEAN) -> BOOLEAN,r_base::aggregate::max(INTEGER, BOOLEAN) -> INTEGER,r_base::aggregate::max(INTEGER) -> INTEGER,r_base::aggregate::max(DOUBLE, BOOLEAN) -> DOUBLE,r_base::aggregate::max(DOUBLE) -> DOUBLE,r_base::aggregate::max(TIMESTAMP, BOOLEAN) -> TIMESTAMP,r_base::aggregate::max(TIMESTAMP) -> TIMESTAMP,r_base::aggregate::max(DATE, BOOLEAN) -> DATE,r_base::aggregate::max(DATE) -> DATE","call":"r_base::aggregate::max(VARCHAR, BOOLEAN)","error_subtype":"NO_MATCHING_FUNCTION"}

12 changes: 6 additions & 6 deletions duckdb-rfuns-r/tests/testthat/_snaps/sum.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Error in `rfuns_sum()`:
! binding error
Caused by error:
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::sum(BOOLEAN, VARCHAR)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::sum(BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER) -> INTEGER\n\tr_base::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::sum(DOUBLE) -> DOUBLE\n","name":"r_base::sum","candidates":"r_base::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::sum(BOOLEAN) -> INTEGER,r_base::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::sum(INTEGER) -> INTEGER,r_base::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::sum(DOUBLE) -> DOUBLE","call":"r_base::sum(BOOLEAN, VARCHAR)","error_subtype":"NO_MATCHING_FUNCTION"}
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::aggregate::sum(BOOLEAN, VARCHAR)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER) -> INTEGER\n\tr_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::aggregate::sum(DOUBLE) -> DOUBLE\n","name":"r_base::aggregate::sum","candidates":"r_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::aggregate::sum(BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER) -> INTEGER,r_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::aggregate::sum(DOUBLE) -> DOUBLE","call":"r_base::aggregate::sum(BOOLEAN, VARCHAR)","error_subtype":"NO_MATCHING_FUNCTION"}

---

Expand All @@ -16,7 +16,7 @@
Error in `rfuns_sum()`:
! binding error
Caused by error:
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::sum(INTEGER, VARCHAR)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::sum(BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER) -> INTEGER\n\tr_base::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::sum(DOUBLE) -> DOUBLE\n","name":"r_base::sum","candidates":"r_base::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::sum(BOOLEAN) -> INTEGER,r_base::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::sum(INTEGER) -> INTEGER,r_base::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::sum(DOUBLE) -> DOUBLE","call":"r_base::sum(INTEGER, VARCHAR)","error_subtype":"NO_MATCHING_FUNCTION"}
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::aggregate::sum(INTEGER, VARCHAR)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER) -> INTEGER\n\tr_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::aggregate::sum(DOUBLE) -> DOUBLE\n","name":"r_base::aggregate::sum","candidates":"r_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::aggregate::sum(BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER) -> INTEGER,r_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::aggregate::sum(DOUBLE) -> DOUBLE","call":"r_base::aggregate::sum(INTEGER, VARCHAR)","error_subtype":"NO_MATCHING_FUNCTION"}

---

Expand All @@ -26,7 +26,7 @@
Error in `rfuns_sum()`:
! binding error
Caused by error:
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::sum(DOUBLE, VARCHAR)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::sum(BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER) -> INTEGER\n\tr_base::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::sum(DOUBLE) -> DOUBLE\n","name":"r_base::sum","candidates":"r_base::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::sum(BOOLEAN) -> INTEGER,r_base::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::sum(INTEGER) -> INTEGER,r_base::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::sum(DOUBLE) -> DOUBLE","call":"r_base::sum(DOUBLE, VARCHAR)","error_subtype":"NO_MATCHING_FUNCTION"}
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::aggregate::sum(DOUBLE, VARCHAR)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER) -> INTEGER\n\tr_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::aggregate::sum(DOUBLE) -> DOUBLE\n","name":"r_base::aggregate::sum","candidates":"r_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::aggregate::sum(BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER) -> INTEGER,r_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::aggregate::sum(DOUBLE) -> DOUBLE","call":"r_base::aggregate::sum(DOUBLE, VARCHAR)","error_subtype":"NO_MATCHING_FUNCTION"}

# r_base::sum(<VARCHAR>

Expand All @@ -36,7 +36,7 @@
Error in `rfuns_sum()`:
! binding error
Caused by error:
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::sum(VARCHAR)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::sum(BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER) -> INTEGER\n\tr_base::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::sum(DOUBLE) -> DOUBLE\n","name":"r_base::sum","candidates":"r_base::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::sum(BOOLEAN) -> INTEGER,r_base::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::sum(INTEGER) -> INTEGER,r_base::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::sum(DOUBLE) -> DOUBLE","call":"r_base::sum(VARCHAR)","error_subtype":"NO_MATCHING_FUNCTION"}
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::aggregate::sum(VARCHAR)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER) -> INTEGER\n\tr_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::aggregate::sum(DOUBLE) -> DOUBLE\n","name":"r_base::aggregate::sum","candidates":"r_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::aggregate::sum(BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER) -> INTEGER,r_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::aggregate::sum(DOUBLE) -> DOUBLE","call":"r_base::aggregate::sum(VARCHAR)","error_subtype":"NO_MATCHING_FUNCTION"}

---

Expand All @@ -46,7 +46,7 @@
Error in `rfuns_sum()`:
! binding error
Caused by error:
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::sum(VARCHAR, BOOLEAN)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::sum(BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER) -> INTEGER\n\tr_base::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::sum(DOUBLE) -> DOUBLE\n","name":"r_base::sum","candidates":"r_base::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::sum(BOOLEAN) -> INTEGER,r_base::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::sum(INTEGER) -> INTEGER,r_base::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::sum(DOUBLE) -> DOUBLE","call":"r_base::sum(VARCHAR, BOOLEAN)","error_subtype":"NO_MATCHING_FUNCTION"}
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::aggregate::sum(VARCHAR, BOOLEAN)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER) -> INTEGER\n\tr_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::aggregate::sum(DOUBLE) -> DOUBLE\n","name":"r_base::aggregate::sum","candidates":"r_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::aggregate::sum(BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER) -> INTEGER,r_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::aggregate::sum(DOUBLE) -> DOUBLE","call":"r_base::aggregate::sum(VARCHAR, BOOLEAN)","error_subtype":"NO_MATCHING_FUNCTION"}

---

Expand All @@ -56,5 +56,5 @@
Error in `rfuns_sum()`:
! binding error
Caused by error:
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::sum(VARCHAR, BOOLEAN)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::sum(BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::sum(INTEGER) -> INTEGER\n\tr_base::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::sum(DOUBLE) -> DOUBLE\n","name":"r_base::sum","candidates":"r_base::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::sum(BOOLEAN) -> INTEGER,r_base::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::sum(INTEGER) -> INTEGER,r_base::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::sum(DOUBLE) -> DOUBLE","call":"r_base::sum(VARCHAR, BOOLEAN)","error_subtype":"NO_MATCHING_FUNCTION"}
! {"exception_type":"Binder","exception_message":"No function matches the given name and argument types 'r_base::aggregate::sum(VARCHAR, BOOLEAN)'. You might need to add explicit type casts.\n\tCandidate functions:\n\tr_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER\n\tr_base::aggregate::sum(INTEGER) -> INTEGER\n\tr_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE\n\tr_base::aggregate::sum(DOUBLE) -> DOUBLE\n","name":"r_base::aggregate::sum","candidates":"r_base::aggregate::sum(BOOLEAN, BOOLEAN) -> INTEGER,r_base::aggregate::sum(BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER, BOOLEAN) -> INTEGER,r_base::aggregate::sum(INTEGER) -> INTEGER,r_base::aggregate::sum(DOUBLE, BOOLEAN) -> DOUBLE,r_base::aggregate::sum(DOUBLE) -> DOUBLE","call":"r_base::aggregate::sum(VARCHAR, BOOLEAN)","error_subtype":"NO_MATCHING_FUNCTION"}

8 changes: 4 additions & 4 deletions duckdb-rfuns-r/tests/testthat/test-sum.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ test_that("r_base::sum(<BOOLEAN>)", {
x <- c(TRUE, TRUE, FALSE, NA)
empty <- logical()

expect_equal(rfuns_sum(x, na.rm = TRUE) , sum(x, na.rm = TRUE))
expect_equal(rfuns_sum(x, na.rm = FALSE), sum(x, na.rm = FALSE))
expect_equal(rfuns_sum(x, na.rm = TRUE)[1] , sum(x, na.rm = TRUE))
expect_equal(rfuns_sum(x, na.rm = FALSE)[1], sum(x, na.rm = FALSE))
expect_equal(rfuns_sum(empty, na.rm = FALSE), sum(empty, na.rm = TRUE))
expect_equal(rfuns_sum(empty, na.rm = TRUE) , sum(empty, na.rm = FALSE))

expect_equal(rfuns_sum(x) , sum(x))
expect_equal(rfuns_sum(x), sum(x))
expect_equal(rfuns_sum(x)[1] , sum(x))
expect_equal(rfuns_sum(x)[1], sum(x))
expect_equal(rfuns_sum(empty), sum(empty))
expect_equal(rfuns_sum(empty), sum(empty))
})
Expand Down
6 changes: 3 additions & 3 deletions src/include/rfuns_extension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ ScalarFunctionSet base_r_as_integer();
ScalarFunctionSet base_r_as_numeric();

// sum
AggregateFunctionSet base_r_sum();
AggregateFunctionSet base_r_min();
AggregateFunctionSet base_r_max();
AggregateFunctionSet base_r_aggregate_sum();
AggregateFunctionSet base_r_aggregate_min();
AggregateFunctionSet base_r_aggregate_max();

ScalarFunctionSet binary_dispatch(ScalarFunctionSet fn) ;

Expand Down
8 changes: 4 additions & 4 deletions src/minmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ AggregateFunctionSet base_r_minmax(std::string name) {
return set;
}

AggregateFunctionSet base_r_min() {
return base_r_minmax<RMinOperation>("r_base::min");
AggregateFunctionSet base_r_aggregate_min() {
return base_r_minmax<RMinOperation>("r_base::aggregate::min");
}

AggregateFunctionSet base_r_max() {
return base_r_minmax<RMaxOperation>("r_base::max");
AggregateFunctionSet base_r_aggregate_max() {
return base_r_minmax<RMaxOperation>("r_base::aggregate::max");
}


Expand Down
6 changes: 3 additions & 3 deletions src/rfuns_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ static void register_rfuns(DatabaseInstance &instance) {
ExtensionUtil::RegisterFunction(instance, base_r_as_integer());
ExtensionUtil::RegisterFunction(instance, base_r_as_numeric());

ExtensionUtil::RegisterFunction(instance, base_r_sum());
ExtensionUtil::RegisterFunction(instance, base_r_min());
ExtensionUtil::RegisterFunction(instance, base_r_max());
ExtensionUtil::RegisterFunction(instance, base_r_aggregate_sum());
ExtensionUtil::RegisterFunction(instance, base_r_aggregate_min());
ExtensionUtil::RegisterFunction(instance, base_r_aggregate_max());
}
} // namespace rfuns

Expand Down
4 changes: 2 additions & 2 deletions src/sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ void add_RSum(AggregateFunctionSet& set, const LogicalType& type) {
));
}

AggregateFunctionSet base_r_sum() {
AggregateFunctionSet set("r_base::sum");
AggregateFunctionSet base_r_aggregate_sum() {
AggregateFunctionSet set("r_base::aggregate::sum");

add_RSum(set, LogicalType::BOOLEAN);
add_RSum(set, LogicalType::INTEGER);
Expand Down
Loading