You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The str_flatten function is translated to string_agg when using the Redshift backend. The string_agg function is not supported by Redshift. Instead str_flatten should be translated into LISTAGG.
Will submit a pull request soon! :)
Please see the reprex below:
library(dbplyr)
library(DBI)
library(reprex)
con<- dbConnect(RPostgres::Redshift(),
host= ,
dbname= ,
port= ,
user= ,
password= )
example_table<-dplyr::tribble(
~customer, ~day, ~item,
"A", 1, "WATER",
"A", 3, "BREAD",
"A", 2, "JUICE",
"B", 1, "APPLE",
"B", 4, "BANANA",
"C", 1, "MILK"
)
table_db<-dplyr::copy_to(con, example_table, temporary=T)
table_db %>%
dplyr::group_by(customer) %>%
dplyr::summarize(flat_string= str_flatten(item, "-"))
#> Error: Failed to prepare query: ERROR: function string_agg(character varying, "unknown") does not exist#> HINT: No function matches the given name and argument types. You may need to add explicit type casts.table_db %>%
dplyr::group_by(customer) %>%
dbplyr::window_order(day) %>%
dplyr::mutate(flat_string= str_flatten(item, "-"))
#> Error: Failed to prepare query: ERROR: function string_agg(character varying, "unknown") does not exist#> HINT: No function matches the given name and argument types. You may need to add explicit type casts.
The
str_flatten
function is translated tostring_agg
when using the Redshift backend. Thestring_agg
function is not supported by Redshift. Insteadstr_flatten
should be translated intoLISTAGG
.Will submit a pull request soon! :)
Please see the reprex below:
Created on 2022-03-25 by the reprex package (v2.0.0)
The text was updated successfully, but these errors were encountered: