Skip to content

Commit d1e7c90

Browse files
feat!: Update for polars 1.0.0 (#194)
1 parent 4f63ab0 commit d1e7c90

File tree

151 files changed

+2022
-1465
lines changed

Some content is hidden

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

151 files changed

+2022
-1465
lines changed

.github/workflows/R-CMD-check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ jobs:
6060
- name: Install r-polars
6161
run: |
6262
Sys.setenv(NOT_CRAN = "true") # Enable installation with pre-built Rust library binary, or enable Rust caching
63-
install.packages("polars", repos = "https://community.r-multiverse.org")
63+
install.packages("polars", repos = c("https://community.r-multiverse.org", getOption("repos")))
64+
6465
shell: Rscript {0}
6566

6667
- name: Dependencies

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Imports:
2929
dplyr,
3030
glue,
3131
lifecycle,
32-
polars (>= 0.21.0),
32+
polars (>= 1.0.0),
3333
rlang,
3434
tidyr,
3535
tidyselect,

NAMESPACE

Lines changed: 85 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,85 @@
11
# Generated by roxygen2: do not edit by hand
22

3-
S3method(add_count,RPolarsDataFrame)
4-
S3method(add_count,RPolarsLazyFrame)
5-
S3method(anti_join,RPolarsDataFrame)
6-
S3method(anti_join,RPolarsLazyFrame)
7-
S3method(arrange,RPolarsDataFrame)
8-
S3method(arrange,RPolarsLazyFrame)
9-
S3method(as_tibble,RPolarsDataFrame)
10-
S3method(as_tibble,RPolarsLazyFrame)
11-
S3method(as_tibble,tidypolars)
12-
S3method(collect,RPolarsLazyFrame)
13-
S3method(complete,RPolarsDataFrame)
14-
S3method(complete,RPolarsLazyFrame)
15-
S3method(compute,RPolarsLazyFrame)
16-
S3method(count,RPolarsDataFrame)
17-
S3method(count,RPolarsLazyFrame)
18-
S3method(cross_join,RPolarsDataFrame)
19-
S3method(cross_join,RPolarsLazyFrame)
20-
S3method(distinct,RPolarsDataFrame)
21-
S3method(distinct,RPolarsLazyFrame)
22-
S3method(drop_na,RPolarsDataFrame)
23-
S3method(drop_na,RPolarsLazyFrame)
24-
S3method(explain,RPolarsLazyFrame)
25-
S3method(fill,RPolarsDataFrame)
26-
S3method(fill,RPolarsLazyFrame)
27-
S3method(filter,RPolarsDataFrame)
28-
S3method(filter,RPolarsLazyFrame)
29-
S3method(full_join,RPolarsDataFrame)
30-
S3method(full_join,RPolarsLazyFrame)
31-
S3method(group_by,RPolarsDataFrame)
32-
S3method(group_by,RPolarsLazyFrame)
33-
S3method(group_keys,RPolarsDataFrame)
34-
S3method(group_keys,RPolarsLazyFrame)
35-
S3method(group_split,RPolarsDataFrame)
36-
S3method(group_vars,RPolarsDataFrame)
37-
S3method(group_vars,RPolarsLazyFrame)
38-
S3method(inner_join,RPolarsDataFrame)
39-
S3method(inner_join,RPolarsLazyFrame)
40-
S3method(left_join,RPolarsDataFrame)
41-
S3method(left_join,RPolarsLazyFrame)
42-
S3method(mutate,RPolarsDataFrame)
43-
S3method(mutate,RPolarsLazyFrame)
44-
S3method(pivot_longer,RPolarsDataFrame)
45-
S3method(pivot_longer,RPolarsLazyFrame)
46-
S3method(pivot_wider,RPolarsDataFrame)
3+
S3method(add_count,polars_data_frame)
4+
S3method(add_count,polars_lazy_frame)
5+
S3method(anti_join,polars_data_frame)
6+
S3method(anti_join,polars_lazy_frame)
7+
S3method(arrange,polars_data_frame)
8+
S3method(arrange,polars_lazy_frame)
9+
S3method(collect,polars_lazy_frame)
10+
S3method(complete,polars_data_frame)
11+
S3method(complete,polars_lazy_frame)
12+
S3method(compute,polars_lazy_frame)
13+
S3method(count,polars_data_frame)
14+
S3method(count,polars_lazy_frame)
15+
S3method(cross_join,polars_data_frame)
16+
S3method(cross_join,polars_lazy_frame)
17+
S3method(distinct,polars_data_frame)
18+
S3method(distinct,polars_lazy_frame)
19+
S3method(drop_na,polars_data_frame)
20+
S3method(drop_na,polars_lazy_frame)
21+
S3method(explain,polars_lazy_frame)
22+
S3method(fill,polars_data_frame)
23+
S3method(fill,polars_lazy_frame)
24+
S3method(filter,polars_data_frame)
25+
S3method(filter,polars_lazy_frame)
26+
S3method(full_join,polars_data_frame)
27+
S3method(full_join,polars_lazy_frame)
28+
S3method(group_by,polars_data_frame)
29+
S3method(group_by,polars_lazy_frame)
30+
S3method(group_keys,polars_data_frame)
31+
S3method(group_keys,polars_lazy_frame)
32+
S3method(group_split,polars_data_frame)
33+
S3method(group_vars,polars_data_frame)
34+
S3method(group_vars,polars_lazy_frame)
35+
S3method(inner_join,polars_data_frame)
36+
S3method(inner_join,polars_lazy_frame)
37+
S3method(left_join,polars_data_frame)
38+
S3method(left_join,polars_lazy_frame)
39+
S3method(mutate,polars_data_frame)
40+
S3method(mutate,polars_lazy_frame)
41+
S3method(pivot_longer,polars_data_frame)
42+
S3method(pivot_longer,polars_lazy_frame)
43+
S3method(pivot_wider,polars_data_frame)
4744
S3method(print,tidypolars)
48-
S3method(pull,RPolarsDataFrame)
49-
S3method(pull,RPolarsLazyFrame)
50-
S3method(relocate,RPolarsDataFrame)
51-
S3method(relocate,RPolarsLazyFrame)
52-
S3method(rename,RPolarsDataFrame)
53-
S3method(rename,RPolarsLazyFrame)
54-
S3method(rename_with,RPolarsDataFrame)
55-
S3method(rename_with,RPolarsLazyFrame)
56-
S3method(replace_na,RPolarsDataFrame)
57-
S3method(replace_na,RPolarsLazyFrame)
58-
S3method(right_join,RPolarsDataFrame)
59-
S3method(right_join,RPolarsLazyFrame)
60-
S3method(rowwise,RPolarsDataFrame)
61-
S3method(rowwise,RPolarsLazyFrame)
62-
S3method(select,RPolarsDataFrame)
63-
S3method(select,RPolarsLazyFrame)
64-
S3method(semi_join,RPolarsDataFrame)
65-
S3method(semi_join,RPolarsLazyFrame)
66-
S3method(separate,RPolarsDataFrame)
67-
S3method(separate,RPolarsLazyFrame)
68-
S3method(slice_head,RPolarsDataFrame)
69-
S3method(slice_head,RPolarsLazyFrame)
70-
S3method(slice_sample,RPolarsDataFrame)
71-
S3method(slice_tail,RPolarsDataFrame)
72-
S3method(slice_tail,RPolarsLazyFrame)
73-
S3method(summarise,RPolarsDataFrame)
74-
S3method(summarise,RPolarsLazyFrame)
75-
S3method(summarize,RPolarsDataFrame)
76-
S3method(summarize,RPolarsLazyFrame)
77-
S3method(summary,RPolarsDataFrame)
78-
S3method(tally,RPolarsDataFrame)
79-
S3method(tally,RPolarsLazyFrame)
80-
S3method(uncount,RPolarsDataFrame)
81-
S3method(uncount,RPolarsLazyFrame)
82-
S3method(ungroup,RPolarsDataFrame)
83-
S3method(ungroup,RPolarsLazyFrame)
84-
S3method(unite,RPolarsDataFrame)
85-
S3method(unite,RPolarsLazyFrame)
45+
S3method(pull,polars_data_frame)
46+
S3method(pull,polars_lazy_frame)
47+
S3method(relocate,polars_data_frame)
48+
S3method(relocate,polars_lazy_frame)
49+
S3method(rename,polars_data_frame)
50+
S3method(rename,polars_lazy_frame)
51+
S3method(rename_with,polars_data_frame)
52+
S3method(rename_with,polars_lazy_frame)
53+
S3method(replace_na,polars_data_frame)
54+
S3method(replace_na,polars_lazy_frame)
55+
S3method(right_join,polars_data_frame)
56+
S3method(right_join,polars_lazy_frame)
57+
S3method(rowwise,polars_data_frame)
58+
S3method(rowwise,polars_lazy_frame)
59+
S3method(select,polars_data_frame)
60+
S3method(select,polars_lazy_frame)
61+
S3method(semi_join,polars_data_frame)
62+
S3method(semi_join,polars_lazy_frame)
63+
S3method(separate,polars_data_frame)
64+
S3method(separate,polars_lazy_frame)
65+
S3method(slice_head,polars_data_frame)
66+
S3method(slice_head,polars_lazy_frame)
67+
S3method(slice_sample,polars_data_frame)
68+
S3method(slice_tail,polars_data_frame)
69+
S3method(slice_tail,polars_lazy_frame)
70+
S3method(summarise,polars_data_frame)
71+
S3method(summarise,polars_lazy_frame)
72+
S3method(summarize,polars_data_frame)
73+
S3method(summarize,polars_lazy_frame)
74+
S3method(summary,polars_data_frame)
75+
S3method(tally,polars_data_frame)
76+
S3method(tally,polars_lazy_frame)
77+
S3method(uncount,polars_data_frame)
78+
S3method(uncount,polars_lazy_frame)
79+
S3method(ungroup,polars_data_frame)
80+
S3method(ungroup,polars_lazy_frame)
81+
S3method(unite,polars_data_frame)
82+
S3method(unite,polars_lazy_frame)
8683
export(as_polars_df)
8784
export(as_polars_lf)
8885
export(bind_cols_polars)
@@ -92,6 +89,9 @@ export(describe_optimized_plan)
9289
export(describe_plan)
9390
export(duplicated_rows)
9491
export(fetch)
92+
export(is_polars_df)
93+
export(is_polars_expr)
94+
export(is_polars_lf)
9595
export(make_unique_id)
9696
export(read_csv_polars)
9797
export(read_ipc_polars)
@@ -118,3 +118,6 @@ import(tidyr)
118118
importFrom(lifecycle,deprecated)
119119
importFrom(polars,as_polars_df)
120120
importFrom(polars,as_polars_lf)
121+
importFrom(polars,is_polars_df)
122+
importFrom(polars,is_polars_expr)
123+
importFrom(polars,is_polars_lf)

NEWS.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
# tidypolars (development version)
22

3+
* `tidypolars` requires `polars` >= 1.0.0. This release of `polars` contains
4+
many breaking changes. Those should be invisible to `tidypolars` users, with
5+
the exception of deprecation messages (see below). However, if your code
6+
contains user-defined functions that use `polars` syntax, you may need to
7+
revise those (#194).
8+
9+
## Deprecations and breaking changes
10+
11+
* The following arguments are deprecated and will be removed in a future
12+
version. The recommended replacement is indicated on the right of the arrow
13+
(#194):
14+
- in `compute()` and `collect()`: `streaming` -> `engine`;
15+
- in `read_csv_polars()` and `scan_csv_polars()`:
16+
* `dtypes` -> `schema_overrides`
17+
* `reuse_downloaded` -> no replacement
18+
- in `read_ndjson_polars` and `scan_ndjson_polars()`:
19+
* `reuse_downloaded` -> no replacement
20+
- in `read_ipc_polars` and `scan_ipc_polars()`:
21+
* `memory_map` -> no replacement
22+
- in `write_csv_polars()` and `sink_csv()`:
23+
* `null_values` -> `null_value`
24+
* `quote` -> `quote_char`
25+
- in `write_ndjson_polars()`:
26+
* `pretty` -> no replacement
27+
* `row_oriented` -> no replacement
28+
- in `write_ipc_polars()`:
29+
* `future` -> `compat_level`
30+
31+
* `fetch()` is deprecated, use `head()` before `collect()` instead (#194).
32+
33+
* `group_keys()` now returns a `tibble` and not a `data.frame` anymore (#194).
34+
35+
* `lubridate::make_date()`, `lubridate::make_datetime()`, and `ISOdatetime()`
36+
now error if some components go over their expected range, e.g. `month = 20`
37+
or `hour = 25`. Before, those functions were returning `NA` in this situation
38+
(#194).
39+
40+
* `summary()` returns an additional row for the 50% percentile (#194).
41+
342
## New features
443

544
* Added support for various `lubridate` functions:

R/arrange.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#' group_by(x1) |>
2323
#' arrange(-x2, .by_group = TRUE)
2424

25-
arrange.RPolarsDataFrame <- function(.data, ..., .by_group = FALSE) {
25+
arrange.polars_data_frame <- function(.data, ..., .by_group = FALSE) {
2626
grps <- attributes(.data)$pl_grps
2727
mo <- attributes(data)$maintain_grp_order
2828
is_grouped <- !is.null(grps)
@@ -50,14 +50,14 @@ arrange.RPolarsDataFrame <- function(.data, ..., .by_group = FALSE) {
5050
}
5151

5252
out <- if (is_grouped) {
53-
.data$sort(polars_exprs, descending = descending, nulls_last = TRUE) |>
53+
.data$sort(!!!polars_exprs, descending = descending, nulls_last = TRUE) |>
5454
group_by(all_of(grps), maintain_order = mo)
5555
} else {
56-
.data$sort(polars_exprs, descending = descending, nulls_last = TRUE)
56+
.data$sort(!!!polars_exprs, descending = descending, nulls_last = TRUE)
5757
}
5858

5959
add_tidypolars_class(out)
6060
}
6161

6262
#' @export
63-
arrange.RPolarsLazyFrame <- arrange.RPolarsDataFrame
63+
arrange.polars_lazy_frame <- arrange.polars_data_frame

R/as_tibble.R

Lines changed: 0 additions & 41 deletions
This file was deleted.

R/bind.R

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ concat_ <- function(..., how, .id = NULL, .name_repair = NULL) {
7878
}
7979

8080
all_df <- all(
81-
vapply(dots, inherits, "RPolarsDataFrame", FUN.VALUE = logical(1L))
81+
vapply(dots, inherits, "polars_data_frame", FUN.VALUE = logical(1L))
8282
)
8383
all_lf <- all(
84-
vapply(dots, inherits, "RPolarsLazyFrame", FUN.VALUE = logical(1L))
84+
vapply(dots, inherits, "polars_lazy_frame", FUN.VALUE = logical(1L))
8585
)
8686

8787
if (!(all_df || all_lf)) {
@@ -150,26 +150,27 @@ concat_ <- function(..., how, .id = NULL, .name_repair = NULL) {
150150

151151
for (i in seq_along(dots)) {
152152
n_names <- ncol(dots[[i]])
153-
dots[[i]] <- dots[[i]]$rename(mapping[1:n_names])
153+
dots[[i]] <- dots[[i]]$rename(!!!mapping[1:n_names])
154154
mapping <- mapping[-(1:n_names)]
155155
}
156156
}
157157
}
158158

159-
if (inherits(dots[[1]], "RPolarsDataFrame")) {
160-
pl$concat(dots, how = how)
159+
if (is_polars_df(dots[[1]])) {
160+
pl$concat(!!!dots, how = how)
161161
} else {
162+
# TODO: remove this limitation
162163
if (length(dots) > 2) {
163164
cli_abort(
164165
"{.code bind_cols_polars()} doesn't work with more than two LazyFrames.",
165166
call = caller_env()
166167
)
167168
}
168-
dots[[1]]$with_context(dots[[2]])$select(pl$all())
169+
pl$concat(dots[[1]], dots[[2]], how = "horizontal")
169170
}
170171
},
171172
# default
172-
pl$concat(dots, how = how)
173+
pl$concat(!!!dots, how = how)
173174
)
174175
add_tidypolars_class(out)
175176
}

0 commit comments

Comments
 (0)