Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add missing functions and docs for LazyFrame #49

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0bea71e
init
etiennebacher Dec 14, 2024
d967634
remove pub keyword
etiennebacher Dec 15, 2024
75c2a2e
docs of limit
etiennebacher Dec 15, 2024
a63d623
only named args in profile()
etiennebacher Dec 15, 2024
ba5deb4
wrap clone()
etiennebacher Dec 15, 2024
9219ccd
remove with_context()
etiennebacher Dec 15, 2024
a1b5f16
adjust $clear()
etiennebacher Dec 15, 2024
10710ca
inherit from args_dots_empty in docs
etiennebacher Dec 15, 2024
91e2823
unnecessary change in rust
etiennebacher Dec 15, 2024
0f11c25
same
etiennebacher Dec 15, 2024
8d283f7
fix: remove alternative way to convert R objects
eitsupi Dec 16, 2024
6d55109
Merge branch 'main' into lazyframe-methods
etiennebacher Dec 17, 2024
29a8cad
remove deserialize_lf()
etiennebacher Dec 17, 2024
4efb53b
Merge branch 'main' into lazyframe-methods
etiennebacher Dec 25, 2024
dd385ae
Merge branch 'main' into lazyframe-methods
etiennebacher Jan 5, 2025
c296299
Merge branch 'main' into lazyframe-methods
etiennebacher Jan 7, 2025
14898fa
Merge branch 'main' into lazyframe-methods
etiennebacher Jan 11, 2025
a36d107
Merge branch 'main' into lazyframe-methods
etiennebacher Jan 14, 2025
3e1b70e
Merge branch 'main' into lazyframe-methods
etiennebacher Jan 16, 2025
fb21d78
try partial fix wasm32
etiennebacher Jan 16, 2025
a8a277d
Merge branch 'main' into lazyframe-methods
etiennebacher Jan 18, 2025
1337274
Merge branch 'main' into lazyframe-methods
etiennebacher Jan 20, 2025
c2cd386
change parquet statistics handling
etiennebacher Jan 23, 2025
56aae32
add allow_exact_matches in asof_join
etiennebacher Jan 23, 2025
eb7920f
redoc [skip ci]
etiennebacher Jan 23, 2025
c51ffd1
Merge branch 'main' into lazyframe-methods
etiennebacher Feb 3, 2025
93860a5
remove `sink_*` functions
etiennebacher Feb 3, 2025
d272746
remove parse_parquet_compression()
etiennebacher Feb 3, 2025
9050ab1
add arg `check_sortedness` in `join_asof()`
etiennebacher Feb 3, 2025
73277f0
redoc
etiennebacher Feb 3, 2025
975a569
remove conversion to IpcCompression
etiennebacher Feb 3, 2025
abf4366
typo
etiennebacher Feb 3, 2025
37ce3de
refactor: fix some lints in Rust code (#76)
etiennebacher Feb 3, 2025
1bd900d
Merge branch 'main' into lazyframe-methods
etiennebacher Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export(is_polars_expr)
export(is_polars_lf)
export(is_polars_selector)
export(is_polars_series)
export(parquet_statistics)
export(pl)
import(rlang)
useDynLib(neopolars, .registration = TRUE)
301 changes: 301 additions & 0 deletions R/000-wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -3307,6 +3307,18 @@ class(`PlRExpr`) <- c("PlRExpr__bundle", "savvy_neopolars__sealed")

### wrapper functions for PlRLazyFrame

`PlRLazyFrame_bottom_k` <- function(self) {
function(`k`, `by`, `reverse`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_bottom_k__impl, `self`, `k`, `by`, `reverse`))
}
}

`PlRLazyFrame_cache` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_cache__impl, `self`))
}
}

`PlRLazyFrame_cast` <- function(self) {
function(`dtypes`, `strict`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_cast__impl, `self`, `dtypes`, `strict`))
Expand All @@ -3320,6 +3332,12 @@ class(`PlRExpr`) <- c("PlRExpr__bundle", "savvy_neopolars__sealed")
}
}

`PlRLazyFrame_clone` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_clone__impl, `self`))
}
}

`PlRLazyFrame_collect` <- function(self) {
function() {
.savvy_wrap_PlRDataFrame(.Call(savvy_PlRLazyFrame_collect__impl, `self`))
Expand All @@ -3332,6 +3350,12 @@ class(`PlRExpr`) <- c("PlRExpr__bundle", "savvy_neopolars__sealed")
}
}

`PlRLazyFrame_count` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_count__impl, `self`))
}
}

`PlRLazyFrame_describe_optimized_plan` <- function(self) {
function() {
.Call(savvy_PlRLazyFrame_describe_optimized_plan__impl, `self`)
Expand Down Expand Up @@ -3362,6 +3386,32 @@ class(`PlRExpr`) <- c("PlRExpr__bundle", "savvy_neopolars__sealed")
}
}

`PlRLazyFrame_drop_nulls` <- function(self) {
function(`subset` = NULL) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_drop_nulls__impl, `self`, `subset`))
}
}

`PlRLazyFrame_explode` <- function(self) {
function(`column`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_explode__impl, `self`, `column`))
}
}

`PlRLazyFrame_fill_nan` <- function(self) {
function(`fill_value`) {
`fill_value` <- .savvy_extract_ptr(`fill_value`, "PlRExpr")
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_fill_nan__impl, `self`, `fill_value`))
}
}

`PlRLazyFrame_fill_null` <- function(self) {
function(`fill_value`) {
`fill_value` <- .savvy_extract_ptr(`fill_value`, "PlRExpr")
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_fill_null__impl, `self`, `fill_value`))
}
}

`PlRLazyFrame_filter` <- function(self) {
function(`predicate`) {
`predicate` <- .savvy_extract_ptr(`predicate`, "PlRExpr")
Expand All @@ -3375,62 +3425,313 @@ class(`PlRExpr`) <- c("PlRExpr__bundle", "savvy_neopolars__sealed")
}
}

`PlRLazyFrame_group_by_dynamic` <- function(self) {
function(`index_column`, `every`, `period`, `offset`, `label`, `include_boundaries`, `closed`, `group_by`, `start_by`) {
`index_column` <- .savvy_extract_ptr(`index_column`, "PlRExpr")
.savvy_wrap_PlRLazyGroupBy(.Call(savvy_PlRLazyFrame_group_by_dynamic__impl, `self`, `index_column`, `every`, `period`, `offset`, `label`, `include_boundaries`, `closed`, `group_by`, `start_by`))
}
}

`PlRLazyFrame_join` <- function(self) {
function(`other`, `left_on`, `right_on`, `allow_parallel`, `force_parallel`, `join_nulls`, `how`, `suffix`, `validate`, `coalesce` = NULL) {
`other` <- .savvy_extract_ptr(`other`, "PlRLazyFrame")
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_join__impl, `self`, `other`, `left_on`, `right_on`, `allow_parallel`, `force_parallel`, `join_nulls`, `how`, `suffix`, `validate`, `coalesce`))
}
}

`PlRLazyFrame_join_asof` <- function(self) {
function(`other`, `left_on`, `right_on`, `allow_parallel`, `force_parallel`, `suffix`, `coalesce`, `strategy`, `allow_eq`, `left_by` = NULL, `right_by` = NULL, `tolerance` = NULL, `tolerance_str` = NULL) {
`other` <- .savvy_extract_ptr(`other`, "PlRLazyFrame")
`left_on` <- .savvy_extract_ptr(`left_on`, "PlRExpr")
`right_on` <- .savvy_extract_ptr(`right_on`, "PlRExpr")
`tolerance` <- .savvy_extract_ptr(`tolerance`, "PlRSeries")
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_join_asof__impl, `self`, `other`, `left_on`, `right_on`, `allow_parallel`, `force_parallel`, `suffix`, `coalesce`, `strategy`, `allow_eq`, `left_by`, `right_by`, `tolerance`, `tolerance_str`))
}
}

`PlRLazyFrame_join_where` <- function(self) {
function(`other`, `predicates`, `suffix`) {
`other` <- .savvy_extract_ptr(`other`, "PlRLazyFrame")
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_join_where__impl, `self`, `other`, `predicates`, `suffix`))
}
}

`PlRLazyFrame_max` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_max__impl, `self`))
}
}

`PlRLazyFrame_mean` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_mean__impl, `self`))
}
}

`PlRLazyFrame_median` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_median__impl, `self`))
}
}

`PlRLazyFrame_merge_sorted` <- function(self) {
function(`other`, `key`) {
`other` <- .savvy_extract_ptr(`other`, "PlRLazyFrame")
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_merge_sorted__impl, `self`, `other`, `key`))
}
}

`PlRLazyFrame_min` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_min__impl, `self`))
}
}

`PlRLazyFrame_null_count` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_null_count__impl, `self`))
}
}

`PlRLazyFrame_optimization_toggle` <- function(self) {
function(`type_coercion`, `predicate_pushdown`, `projection_pushdown`, `simplify_expression`, `slice_pushdown`, `comm_subplan_elim`, `comm_subexpr_elim`, `cluster_with_columns`, `streaming`, `_eager`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_optimization_toggle__impl, `self`, `type_coercion`, `predicate_pushdown`, `projection_pushdown`, `simplify_expression`, `slice_pushdown`, `comm_subplan_elim`, `comm_subexpr_elim`, `cluster_with_columns`, `streaming`, `_eager`))
}
}

`PlRLazyFrame_profile` <- function(self) {
function() {
.Call(savvy_PlRLazyFrame_profile__impl, `self`)
}
}

`PlRLazyFrame_quantile` <- function(self) {
function(`quantile`, `interpolation`) {
`quantile` <- .savvy_extract_ptr(`quantile`, "PlRExpr")
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_quantile__impl, `self`, `quantile`, `interpolation`))
}
}

`PlRLazyFrame_rename` <- function(self) {
function(`existing`, `new`, `strict`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_rename__impl, `self`, `existing`, `new`, `strict`))
}
}

`PlRLazyFrame_reverse` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_reverse__impl, `self`))
}
}

`PlRLazyFrame_rolling` <- function(self) {
function(`index_column`, `period`, `offset`, `closed`, `by`) {
`index_column` <- .savvy_extract_ptr(`index_column`, "PlRExpr")
.savvy_wrap_PlRLazyGroupBy(.Call(savvy_PlRLazyFrame_rolling__impl, `self`, `index_column`, `period`, `offset`, `closed`, `by`))
}
}

`PlRLazyFrame_select` <- function(self) {
function(`exprs`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_select__impl, `self`, `exprs`))
}
}

`PlRLazyFrame_select_seq` <- function(self) {
function(`exprs`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_select_seq__impl, `self`, `exprs`))
}
}

`PlRLazyFrame_serialize` <- function(self) {
function() {
.Call(savvy_PlRLazyFrame_serialize__impl, `self`)
}
}

`PlRLazyFrame_shift` <- function(self) {
function(`n`, `fill_value` = NULL) {
`n` <- .savvy_extract_ptr(`n`, "PlRExpr")
`fill_value` <- .savvy_extract_ptr(`fill_value`, "PlRExpr")
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_shift__impl, `self`, `n`, `fill_value`))
}
}

`PlRLazyFrame_sink_csv` <- function(self) {
function(`path`, `include_bom`, `include_header`, `separator`, `line_terminator`, `quote_char`, `maintain_order`, `batch_size`, `retries`, `datetime_format` = NULL, `date_format` = NULL, `time_format` = NULL, `float_scientific` = NULL, `float_precision` = NULL, `null_value` = NULL, `quote_style` = NULL, `storage_options` = NULL) {
invisible(.Call(savvy_PlRLazyFrame_sink_csv__impl, `self`, `path`, `include_bom`, `include_header`, `separator`, `line_terminator`, `quote_char`, `maintain_order`, `batch_size`, `retries`, `datetime_format`, `date_format`, `time_format`, `float_scientific`, `float_precision`, `null_value`, `quote_style`, `storage_options`))
}
}

`PlRLazyFrame_sink_ipc` <- function(self) {
function(`path`, `maintain_order`, `retries`, `compression` = NULL, `storage_options` = NULL) {
invisible(.Call(savvy_PlRLazyFrame_sink_ipc__impl, `self`, `path`, `maintain_order`, `retries`, `compression`, `storage_options`))
}
}

`PlRLazyFrame_sink_json` <- function(self) {
function(`path`, `maintain_order`, `retries`, `storage_options` = NULL) {
invisible(.Call(savvy_PlRLazyFrame_sink_json__impl, `self`, `path`, `maintain_order`, `retries`, `storage_options`))
}
}

`PlRLazyFrame_sink_parquet` <- function(self) {
function(`path`, `compression`, `maintain_order`, `stat_min`, `stat_max`, `stat_distinct_count`, `stat_null_count`, `retries`, `compression_level` = NULL, `row_group_size` = NULL, `data_page_size` = NULL, `storage_options` = NULL) {
invisible(.Call(savvy_PlRLazyFrame_sink_parquet__impl, `self`, `path`, `compression`, `maintain_order`, `stat_min`, `stat_max`, `stat_distinct_count`, `stat_null_count`, `retries`, `compression_level`, `row_group_size`, `data_page_size`, `storage_options`))
}
}

`PlRLazyFrame_slice` <- function(self) {
function(`offset`, `len` = NULL) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_slice__impl, `self`, `offset`, `len`))
}
}

`PlRLazyFrame_sort` <- function(self) {
function(`by_column`, `descending`, `nulls_last`, `maintain_order`, `multithreaded`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_sort__impl, `self`, `by_column`, `descending`, `nulls_last`, `maintain_order`, `multithreaded`))
}
}

`PlRLazyFrame_sort_by_exprs` <- function(self) {
function(`by`, `descending`, `nulls_last`, `maintain_order`, `multithreaded`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_sort_by_exprs__impl, `self`, `by`, `descending`, `nulls_last`, `maintain_order`, `multithreaded`))
}
}

`PlRLazyFrame_std` <- function(self) {
function(`ddof`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_std__impl, `self`, `ddof`))
}
}

`PlRLazyFrame_sum` <- function(self) {
function() {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_sum__impl, `self`))
}
}

`PlRLazyFrame_tail` <- function(self) {
function(`n`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_tail__impl, `self`, `n`))
}
}

`PlRLazyFrame_to_dot` <- function(self) {
function(`optimized`) {
.savvy_wrap_String(.Call(savvy_PlRLazyFrame_to_dot__impl, `self`, `optimized`))
}
}

`PlRLazyFrame_top_k` <- function(self) {
function(`k`, `by`, `reverse`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_top_k__impl, `self`, `k`, `by`, `reverse`))
}
}

`PlRLazyFrame_unique` <- function(self) {
function(`maintain_order`, `keep`, `subset` = NULL) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_unique__impl, `self`, `maintain_order`, `keep`, `subset`))
}
}

`PlRLazyFrame_unnest` <- function(self) {
function(`columns`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_unnest__impl, `self`, `columns`))
}
}

`PlRLazyFrame_unpivot` <- function(self) {
function(`on`, `index`, `value_name` = NULL, `variable_name` = NULL) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_unpivot__impl, `self`, `on`, `index`, `value_name`, `variable_name`))
}
}

`PlRLazyFrame_var` <- function(self) {
function(`ddof`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_var__impl, `self`, `ddof`))
}
}

`PlRLazyFrame_with_columns` <- function(self) {
function(`exprs`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_with_columns__impl, `self`, `exprs`))
}
}

`PlRLazyFrame_with_columns_seq` <- function(self) {
function(`exprs`) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_with_columns_seq__impl, `self`, `exprs`))
}
}

`PlRLazyFrame_with_row_index` <- function(self) {
function(`name`, `offset` = NULL) {
.savvy_wrap_PlRLazyFrame(.Call(savvy_PlRLazyFrame_with_row_index__impl, `self`, `name`, `offset`))
}
}

`.savvy_wrap_PlRLazyFrame` <- function(ptr) {
e <- new.env(parent = emptyenv())
e$.ptr <- ptr
e$`bottom_k` <- `PlRLazyFrame_bottom_k`(ptr)
e$`cache` <- `PlRLazyFrame_cache`(ptr)
e$`cast` <- `PlRLazyFrame_cast`(ptr)
e$`cast_all` <- `PlRLazyFrame_cast_all`(ptr)
e$`clone` <- `PlRLazyFrame_clone`(ptr)
e$`collect` <- `PlRLazyFrame_collect`(ptr)
e$`collect_schema` <- `PlRLazyFrame_collect_schema`(ptr)
e$`count` <- `PlRLazyFrame_count`(ptr)
e$`describe_optimized_plan` <- `PlRLazyFrame_describe_optimized_plan`(ptr)
e$`describe_optimized_plan_tree` <- `PlRLazyFrame_describe_optimized_plan_tree`(ptr)
e$`describe_plan` <- `PlRLazyFrame_describe_plan`(ptr)
e$`describe_plan_tree` <- `PlRLazyFrame_describe_plan_tree`(ptr)
e$`drop` <- `PlRLazyFrame_drop`(ptr)
e$`drop_nulls` <- `PlRLazyFrame_drop_nulls`(ptr)
e$`explode` <- `PlRLazyFrame_explode`(ptr)
e$`fill_nan` <- `PlRLazyFrame_fill_nan`(ptr)
e$`fill_null` <- `PlRLazyFrame_fill_null`(ptr)
e$`filter` <- `PlRLazyFrame_filter`(ptr)
e$`group_by` <- `PlRLazyFrame_group_by`(ptr)
e$`group_by_dynamic` <- `PlRLazyFrame_group_by_dynamic`(ptr)
e$`join` <- `PlRLazyFrame_join`(ptr)
e$`join_asof` <- `PlRLazyFrame_join_asof`(ptr)
e$`join_where` <- `PlRLazyFrame_join_where`(ptr)
e$`max` <- `PlRLazyFrame_max`(ptr)
e$`mean` <- `PlRLazyFrame_mean`(ptr)
e$`median` <- `PlRLazyFrame_median`(ptr)
e$`merge_sorted` <- `PlRLazyFrame_merge_sorted`(ptr)
e$`min` <- `PlRLazyFrame_min`(ptr)
e$`null_count` <- `PlRLazyFrame_null_count`(ptr)
e$`optimization_toggle` <- `PlRLazyFrame_optimization_toggle`(ptr)
e$`profile` <- `PlRLazyFrame_profile`(ptr)
e$`quantile` <- `PlRLazyFrame_quantile`(ptr)
e$`rename` <- `PlRLazyFrame_rename`(ptr)
e$`reverse` <- `PlRLazyFrame_reverse`(ptr)
e$`rolling` <- `PlRLazyFrame_rolling`(ptr)
e$`select` <- `PlRLazyFrame_select`(ptr)
e$`select_seq` <- `PlRLazyFrame_select_seq`(ptr)
e$`serialize` <- `PlRLazyFrame_serialize`(ptr)
e$`shift` <- `PlRLazyFrame_shift`(ptr)
e$`sink_csv` <- `PlRLazyFrame_sink_csv`(ptr)
e$`sink_ipc` <- `PlRLazyFrame_sink_ipc`(ptr)
e$`sink_json` <- `PlRLazyFrame_sink_json`(ptr)
e$`sink_parquet` <- `PlRLazyFrame_sink_parquet`(ptr)
e$`slice` <- `PlRLazyFrame_slice`(ptr)
e$`sort` <- `PlRLazyFrame_sort`(ptr)
e$`sort_by_exprs` <- `PlRLazyFrame_sort_by_exprs`(ptr)
e$`std` <- `PlRLazyFrame_std`(ptr)
e$`sum` <- `PlRLazyFrame_sum`(ptr)
e$`tail` <- `PlRLazyFrame_tail`(ptr)
e$`to_dot` <- `PlRLazyFrame_to_dot`(ptr)
e$`top_k` <- `PlRLazyFrame_top_k`(ptr)
e$`unique` <- `PlRLazyFrame_unique`(ptr)
e$`unnest` <- `PlRLazyFrame_unnest`(ptr)
e$`unpivot` <- `PlRLazyFrame_unpivot`(ptr)
e$`var` <- `PlRLazyFrame_var`(ptr)
e$`with_columns` <- `PlRLazyFrame_with_columns`(ptr)
e$`with_columns_seq` <- `PlRLazyFrame_with_columns_seq`(ptr)
e$`with_row_index` <- `PlRLazyFrame_with_row_index`(ptr)

class(e) <- c("PlRLazyFrame", "savvy_neopolars__sealed")
e
Expand Down
Loading