Skip to content

Commit

Permalink
Use as.integer() from extension
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed May 5, 2024
1 parent 1ae4365 commit 53fb2a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion R/relational-duckdb.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ duckplyr_macros <- c(
# "as.Date" = '(x) AS strptime(x, \'%Y-%m-%d\')',

"grepl" = "(pattern, x) AS (CASE WHEN x IS NULL THEN FALSE ELSE regexp_matches(x, pattern) END)",
"as.integer" = "(x) AS CAST(x AS int32)",
"if_else" = "(test, yes, no) AS (CASE WHEN test THEN yes ELSE no END)",
"|" = "(x, y) AS (x OR y)",
"&" = "(x, y) AS (x AND y)",
Expand Down
7 changes: 6 additions & 1 deletion R/relational.R
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ rel_translate <- function(
"/" = "___divide",
"log10" = "___log10",
"log" = "___log",
"as.integer" = "r_base::as.integer",
NULL
)

Expand Down Expand Up @@ -263,6 +264,9 @@ rel_translate <- function(

if (name %in% names(aliases)) {
name <- aliases[[name]]
if (grepl("^r_base::", name)) {
meta_ext_register()
}
}
# name <- aliases[name] %|% name

Expand Down Expand Up @@ -309,7 +313,8 @@ rel_translate <- function(
)

if (name == "row_number") {
fun <- relexpr_function("as.integer", list(fun))
fun <- relexpr_function("r_base::as.integer", list(fun))
meta_ext_register()
}
}
fun
Expand Down

0 comments on commit 53fb2a0

Please sign in to comment.