Skip to content

Commit 6bc75d1

Browse files
authored
docs: Introduce concept of funneling alongside eagerness and lazyness (#496)
* check_funneled() * docs: Introduce concept of funneling alongside eagerness and lazyness * chore: Auto-update from GitHub Actions Run: https://github.com/tidyverse/duckplyr/actions/runs/12962250056
1 parent 065f60a commit 6bc75d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+306
-299
lines changed

NAMESPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ S3method(add_count,duckplyr_df)
88
S3method(anti_join,duckplyr_df)
99
S3method(arrange,duckplyr_df)
1010
S3method(as.data.frame,duckplyr_df)
11-
S3method(as.data.frame,lazy_duckplyr_df)
11+
S3method(as.data.frame,funneled_duckplyr_df)
1212
S3method(as_duckdb_tibble,data.frame)
1313
S3method(as_duckdb_tibble,default)
1414
S3method(as_duckdb_tibble,duckplyr_df)
@@ -19,7 +19,7 @@ S3method(as_duckdb_tibble,tbl_duckdb_connection)
1919
S3method(as_tibble,duckplyr_df)
2020
S3method(auto_copy,duckplyr_df)
2121
S3method(collect,duckplyr_df)
22-
S3method(collect,lazy_duckplyr_df)
22+
S3method(collect,funneled_duckplyr_df)
2323
S3method(compute,duckplyr_df)
2424
S3method(count,duckplyr_df)
2525
S3method(cross_join,duckplyr_df)

R/add_count.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ add_count.duckplyr_df <- function(x, ..., wt = NULL, sort = FALSE, name = NULL,
1010
)
1111

1212
# dplyr forward
13-
check_lazy(x, duckplyr_error)
13+
check_funneled(x, duckplyr_error)
1414

1515
add_count <- dplyr$add_count.data.frame
1616
out <- add_count(x, ..., wt = {{ wt }}, sort = sort, name = name, .drop = .drop)

R/anti_join.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ anti_join.duckplyr_df <- function(x, y, by = NULL, copy = FALSE, ..., na_matches
1919
)
2020

2121
# dplyr forward
22-
check_lazy(x, duckplyr_error)
22+
check_funneled(x, duckplyr_error)
2323

2424
anti_join <- dplyr$anti_join.data.frame
2525
out <- anti_join(x, y, by, copy = FALSE, ..., na_matches = na_matches)

R/arrange.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ arrange.duckplyr_df <- function(.data, ..., .by_group = FALSE, .locale = NULL) {
5252
)
5353

5454
# dplyr forward
55-
check_lazy(.data, duckplyr_error)
55+
check_funneled(.data, duckplyr_error)
5656

5757
arrange <- dplyr$arrange.data.frame
5858
out <- arrange(.data, ..., .by_group = .by_group, .locale = .locale)

R/compute-rd.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#' @title Compute results
22
#'
33
#' @description This is a method for the [dplyr::compute()] generic.
4-
#' For a (lazy) duckplyr frame,
4+
#' For a (funneled) duckplyr frame,
55
#' `compute()` executes a query but stores it in a (temporary) table,
66
#' or in a Parquet or CSV file.
77
#' The result is a duckplyr frame that can be used with subsequent dplyr verbs.
88
#'
99
#' @inheritParams dplyr::compute
10-
#' @param lazy Set to `TRUE` to return a lazy or `FALSE` to return an eager data frame,
11-
#' see the "Eager and lazy" section.
12-
#' The default is to inherit the lazyness of the input.
10+
#' @param funnel Set to `TRUE` to return a funneled or `FALSE` to return an unfunneled data frame,
11+
#' see the "Funneling" section.
12+
#' The default is to inherit the funnelness of the input.
1313
#' @param name The name of the table to store the result in.
1414
#' @param schema_name The schema to store the result in, defaults to the current schema.
1515
#' @param temporary Set to `FALSE` to store the result in a permanent table.
16-
#' @inheritSection duckdb_tibble Eager and lazy
16+
#' @inheritSection duckdb_tibble Funneling
1717
#' @examples
1818
#' library(duckplyr)
1919
#' df <- duckdb_tibble(x = c(1, 2))

R/compute.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
compute.duckplyr_df <- function(
55
x,
66
...,
7-
lazy = NULL,
7+
funnel = NULL,
88
name = NULL,
99
schema_name = NULL,
1010
temporary = TRUE
1111
) {
12-
if (is.null(lazy)) {
13-
lazy <- get_lazy_duckplyr_df(x)
12+
if (is.null(funnel)) {
13+
funnel <- get_funnel_duckplyr_df(x)
1414
}
1515
if (is.null(schema_name)) {
1616
schema_name <- ""
@@ -35,16 +35,16 @@ compute.duckplyr_df <- function(
3535

3636
out <- duckplyr_reconstruct(out_rel, x)
3737

38-
if (get_lazy_duckplyr_df(out) != lazy) {
39-
out <- as_duckdb_tibble(out, lazy = lazy)
38+
if (get_funnel_duckplyr_df(out) != funnel) {
39+
out <- as_duckdb_tibble(out, funnel = funnel)
4040
}
4141

4242
return(out)
4343
}
4444
)
4545

4646
# dplyr forward
47-
check_lazy(x, duckplyr_error)
47+
check_funneled(x, duckplyr_error)
4848

4949
compute <- dplyr$compute.data.frame
5050
out <- compute(x, ...)

R/compute_file.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#' @title Compute results to a file
22
#'
33
#' @description
4-
#' These functions apply to (lazy) duckplyr frames.
4+
#' These functions apply to (funneled) duckplyr frames.
55
#' They executes a query and stores the results in a flat file.
66
#' The result is a duckplyr frame that can be used with subsequent dplyr verbs.
77
#'
88
#' `compute_parquet()` creates a Parquet file.
99
#'
1010
#' @inheritParams rlang::args_dots_empty
1111
#' @inheritParams compute.duckplyr_df
12-
#' @inheritSection duckdb_tibble Eager and lazy
12+
#' @inheritSection duckdb_tibble Funneling
1313
#' @param path The path to store the result in.
1414
#' @param options A list of additional options to pass to create the storage format,
1515
#' see <https://duckdb.org/docs/data/parquet/overview#writing-to-parquet-files>
@@ -26,15 +26,15 @@
2626
#' explain(df)
2727
#' @seealso [compute.duckplyr_df()], [dplyr::collect()]
2828
#' @name compute_file
29-
compute_parquet <- function(x, path, ..., lazy = NULL, options = NULL) {
29+
compute_parquet <- function(x, path, ..., funnel = NULL, options = NULL) {
3030
check_dots_empty()
3131

3232
if (is.null(options)) {
3333
options <- list()
3434
}
3535

36-
if (is.null(lazy)) {
37-
lazy <- get_lazy_duckplyr_df(x)
36+
if (is.null(funnel)) {
37+
funnel <- get_funnel_duckplyr_df(x)
3838
}
3939

4040
rel <- duckdb_rel_from_df(x)
@@ -46,23 +46,23 @@ compute_parquet <- function(x, path, ..., lazy = NULL, options = NULL) {
4646
path <- file.path(path, "**", "**.parquet")
4747
}
4848

49-
read_parquet_duckdb(path, lazy = lazy)
49+
read_parquet_duckdb(path, funnel = funnel)
5050
}
5151

5252
#' compute_csv()
5353
#'
5454
#' `compute_csv()` creates a CSV file.
5555
#' @rdname compute_file
5656
#' @export
57-
compute_csv <- function(x, path, ..., lazy = NULL, options = NULL) {
57+
compute_csv <- function(x, path, ..., funnel = NULL, options = NULL) {
5858
check_dots_empty()
5959

6060
if (is.null(options)) {
6161
options <- list()
6262
}
6363

64-
if (is.null(lazy)) {
65-
lazy <- get_lazy_duckplyr_df(x)
64+
if (is.null(funnel)) {
65+
funnel <- get_funnel_duckplyr_df(x)
6666
}
6767

6868
rel <- duckdb_rel_from_df(x)
@@ -74,5 +74,5 @@ compute_csv <- function(x, path, ..., lazy = NULL, options = NULL) {
7474
path <- file.path(path, "**", "**.csv")
7575
}
7676

77-
read_csv_duckdb(path, lazy = lazy)
77+
read_csv_duckdb(path, funnel = funnel)
7878
}

R/count.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ count.duckplyr_df <- function(x, ..., wt = NULL, sort = FALSE, name = NULL, .dro
5959
# out <- count(x_df, !!!quos, wt = {{ wt }}, sort = sort, name = name, .drop = .drop)
6060

6161
# dplyr forward
62-
check_lazy(x, duckplyr_error)
62+
check_funneled(x, duckplyr_error)
6363

6464
count <- dplyr$count.data.frame
6565
out <- count(x, ..., wt = {{ wt }}, sort = sort, name = name, .drop = .drop)

R/cross_join.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cross_join.duckplyr_df <- function(x, y, ..., copy = FALSE, suffix = c(".x", ".y
1010
)
1111

1212
# dplyr forward
13-
check_lazy(x, duckplyr_error)
13+
check_funneled(x, duckplyr_error)
1414

1515
cross_join <- dplyr$cross_join.data.frame
1616
out <- cross_join(x, y, ..., copy = copy, suffix = suffix)

R/distinct.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ distinct.duckplyr_df <- function(.data, ..., .keep_all = FALSE) {
6969
)
7070

7171
# dplyr forward
72-
check_lazy(.data, duckplyr_error)
72+
check_funneled(.data, duckplyr_error)
7373

7474
distinct <- dplyr$distinct.data.frame
7575
out <- distinct(.data, ..., .keep_all = .keep_all)

0 commit comments

Comments
 (0)