Skip to content

Commit

Permalink
Fix nested CTE leading to nested WITH problem
Browse files Browse the repository at this point in the history
  • Loading branch information
jarodmeng committed Nov 6, 2023
1 parent c98a2dd commit c23d816
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# RPresto 1.4.6.9000

* Fixed a bug whereby nested CTEs result in nested WITH. (#261)

# RPresto 1.4.6

* `tidyr::fill()` now works with PrestoConnection. (#233, thanks to @copernican
Expand Down
6 changes: 5 additions & 1 deletion R/dbplyr-src.R
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,12 @@ copy_to.PrestoConnection <- function(dest, df, name = deparse(substitute(df)), o
)
}
con <- dbplyr::remote_con(x)
# We need to speicify sql_options here so that use_presto_cte is passed to
# db_sql_render correctly
# (see https://github.com/tidyverse/dbplyr/issues/1394)
sql <- dbplyr::db_sql_render(
dbplyr::remote_con(x), x, use_presto_cte = FALSE
con = dbplyr::remote_con(x), sql = x,
sql_options = dbplyr::sql_options(), use_presto_cte = FALSE
)
con@session$addCTE(name, sql, replace = TRUE)
} else {
Expand Down

0 comments on commit c23d816

Please sign in to comment.