From 88aa0955775dad93ec1fdb96db05390def4671b8 Mon Sep 17 00:00:00 2001 From: chainsawriot Date: Wed, 17 Jul 2024 15:20:23 +0200 Subject: [PATCH] Add back default support for parquet fix #315 (#444) * Add back default support for parquet ref #315 * Bump ver. --- DESCRIPTION | 5 +++-- NEWS.md | 4 +++- R/export.R | 2 +- R/export_methods.R | 2 +- R/import.R | 2 +- R/import_methods.R | 4 ++-- R/sysdata.rda | Bin 2349 -> 2356 bytes README.md | 2 +- data-raw/single.json | 6 +++--- man/export.Rd | 2 +- man/import.Rd | 2 +- man/rio.Rd | 1 + 12 files changed, 18 insertions(+), 14 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3a5a1d6..8054570 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: rio Type: Package Title: A Swiss-Army Knife for Data I/O -Version: 1.1.1 +Version: 1.2.0 Authors@R: c(person("Jason", "Becker", role = "aut", email = "jason@jbecker.co"), person("Chung-hong", "Chan", role = c("aut", "cre"), email = "chainsawtiney@gmail.com", comment = c(ORCID = "0000-0002-6232-7530")), @@ -53,7 +53,8 @@ Imports: writexl, lifecycle, R.utils, - readr + readr, + nanoparquet Suggests: datasets, bit64, diff --git a/NEWS.md b/NEWS.md index 90d04a1..3d57f0d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,8 @@ -# rio 1.1.1.999 (development) +# rio 1.2.0 * Fix lintr issues #434 (h/t @bisaloo Hugo Gruson) +* Drop support for R < 4.0.0 see #436 +* Add support for parquet in the import tier using `nanoparquet` see rio 1.0.1 below. Bug fixes diff --git a/R/export.R b/R/export.R index 5eea904..54765ae 100644 --- a/R/export.R +++ b/R/export.R @@ -32,7 +32,7 @@ #' \item Weka Attribute-Relation File Format (.arff), using [foreign::write.arff()] #' \item Fixed-width format data (.fwf), using [utils::write.table()] with `row.names = FALSE`, `quote = FALSE`, and `col.names = FALSE` #' \item [CSVY](https://github.com/csvy) (CSV with a YAML metadata header) using [data.table::fwrite()]. -#' \item Apache Arrow Parquet (.parquet), using [arrow::write_parquet()] +#' \item Apache Arrow Parquet (.parquet), using [nanoparquet::write_parquet()] #' \item Feather R/Python interchange format (.feather), using [arrow::write_feather()] #' \item Fast storage (.fst), using [fst::write.fst()] #' \item JSON (.json), using [jsonlite::toJSON()]. In this case, `x` can be a variety of R objects, based on class mapping conventions in this paper: [https://arxiv.org/abs/1403.2805](https://arxiv.org/abs/1403.2805). diff --git a/R/export_methods.R b/R/export_methods.R index 1d07a10..cebde95 100644 --- a/R/export_methods.R +++ b/R/export_methods.R @@ -282,7 +282,7 @@ export_delim <- function(file, x, fwrite = lifecycle::deprecated(), sep = "\t", #' @export .export.rio_parquet <- function(file, x, ...) { - .docall(arrow::write_parquet, ..., args = list(x = x, sink = file)) + .docall(nanoparquet::write_parquet, ..., args = list(x = x, file = file)) } #' @export diff --git a/R/import.R b/R/import.R index 81277fc..9465498 100644 --- a/R/import.R +++ b/R/import.R @@ -42,7 +42,7 @@ #' \item Fortran data (no recognized extension), using [utils::read.fortran()] #' \item Fixed-width format data (.fwf), using a faster version of [utils::read.fwf()] that requires a `widths` argument and by default in rio has `stringsAsFactors = FALSE` #' \item [CSVY](https://github.com/csvy) (CSV with a YAML metadata header) using [data.table::fread()]. -#' \item Apache Arrow Parquet (.parquet), using [arrow::read_parquet()] +#' \item Apache Arrow Parquet (.parquet), using [nanoparquet::read_parquet()] #' \item Feather R/Python interchange format (.feather), using [arrow::read_feather()] #' \item Fast storage (.fst), using [fst::read.fst()] #' \item JSON (.json), using [jsonlite::fromJSON()] diff --git a/R/import_methods.R b/R/import_methods.R index b4add3a..6bac032 100644 --- a/R/import_methods.R +++ b/R/import_methods.R @@ -413,8 +413,8 @@ extract_html_row <- function(x, empty_value) { #' @export .import.rio_parquet <- function(file, which = 1, ...) { - .check_pkg_availability("arrow") - .docall(arrow::read_parquet, ..., args = list(file = file, as_data_frame = TRUE)) + #.check_pkg_availability("arrow") + .docall(nanoparquet::read_parquet, ..., args = list(file = file, options = nanoparquet::parquet_options(class = "data.frame"))) } #' @export diff --git a/R/sysdata.rda b/R/sysdata.rda index 3007435d7b6d08ac9e9aa576621fea19273aab5a..dbdb0b4c41db70b2c64563a9c2e31fdecf892e24 100644 GIT binary patch literal 2356 zcmV-43Cs3ET4*^jL0KkKSp{5W_5cgjf589$|M%^0u$Vvh{qVp4|MWlr00CeMKYMY+ zxIl0-Ccr3-fvso^g&0XBn3^V@rbd&(dPk87>7g-{V47$#GHHo~Xn9XW&<#}fqct%y zO;1xAMt}eS00000&>8^KLxV<*13{oNVgn;XAOJMeAOHb^00>l2)f#@NL()8^nq&c{ znqgeeO6fXNU7MQtP?(^M#>B7YDAJ@bhLl@^-dsefUl4dO|VkPe6fQ%u zRRr%9W(#~GlgZ+vpnx0V;hha+Avc~E^wZ4q3>t2m4X$QCcG~9?%t;nd;lv^sh;YTu z;iACLT<1=jbX!qHEKF(rEV!yDxUX!|R~zz5MySHwXC6FsbCNaFU3#0~dktxRS_g*A+5AWdxs8p^S;CMJx+ zP!%CUhr|+*9atL#g2Iu7b;;jOjFDZm*<}Q;hRO(g>d}oel^iEFgX3Zei6rj$xbL7^!Gp(zSdCV`@WC``a4 zAwx*HmM{T#Gzc3=7vWiM&YSSv2>azxPyNnMos?@o3u9{y_|(^qb`!~2_EZ;F6{9Rc zgg_s3)zwZ{a_r`E7i()pej=~E#yG4s1|0F36oy(irSyqWt7Xow#>oWYu5Bwh&_pw>3)SNcu5H@e@g(?J$yqo)ciXpem`CwQEwNYwVv?ZvT&REoFt1iNVhG#idzDmpK zDcdfRFQTT5s)!(@EDMm>rmD8`cc~RpUwK{gMaAj}E%qdY6|N|Qzl)FNi(eNwvB7}h zES;TOyvI?k-BTZ&U}||*2jLeXc;F)`oY6*Y1}rWdEZ*o0styU;YuGYwf0tfQ3D8Hx zDmj)y*KhHj5p-WepuC>}+& z$jIx>KE@&oGG#M|Clj6yf~iINs@X$M$Vg4zSFP%(uCa6#5dQ{|?wb&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