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

Add pl$read_parquet() #434

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
- New method `$write_csv()` for `DataFrame` (#414).
- New method `$sink_csv()` for `LazyFrame` (#432).
- New method `$dt$time()` to extract the time from a `datetime` variable (#428).
- New method `pl$read_parquet()` that is a shortcut for `pl$scan_parquet()$collect()` (#434).

# polars 0.8.1

Expand Down
30 changes: 29 additions & 1 deletion R/parquet.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' new LazyFrame from parquet file
#' Scan a parquet file
#' @keywords LazyFrame_new
#'
#' @param file string filepath
Expand Down Expand Up @@ -51,6 +51,34 @@ pl$scan_parquet = function(
unwrap(result_lf)
}


#' Read a parquet file
#' @rdname IO_read_parquet
#' @param file string filepath
#' @param n_rows limit rows to scan
#' @param cache bool use cache
#' @param parallel String either Auto, None, Columns or RowGroups. The way to parallelized the scan.
#' @param rechunk bool rechunk reorganize memory layout, potentially make future operations faster , however perform reallocation now.
#' @param row_count_name NULL or string, if a string add a rowcount column named by this string
#' @param row_count_offset integer, the rowcount column can be offset by this value
#' @param low_memory bool, try reduce memory footprint
#' @return DataFrame
#' @name read_parquet
pl$read_parquet = function(
file,
n_rows = NULL,
cache = TRUE,
parallel = c("Auto", "None", "Columns", "RowGroups"),
rechunk = TRUE,
row_count_name = NULL,
row_count_offset = 0L,
low_memory = FALSE) {
mc = match.call()
mc[[1]] = quote(pl$scan_parquet)
eval.parent(mc)$collect()
}


#
# def _prepare_row_count_args(
# row_count_name: str | None = None,
Expand Down
28 changes: 28 additions & 0 deletions man/IO_read_parquet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/IO_scan_parquet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/pl_pl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.