You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using pl$read_csv() to read a gzipped file, an error message is thrown directing the user to "use read_csv for compressed data" (which is what is being used). It looks like read_csv in R is just a wrapper around scan_csv. scan_csv can't be used for compressed data, so this error is thrown for read_csv as well.
I've added a reprex below. I think a previous version of r-polars let me use read_csv on compressed data, but I could be wrong; this could also be breaking change on the Rust side.
library(polars)
if (!suppressMessages(require(R.utils))) stop("Need `R.utils` to gzip file")
# Version used
packageVersion("polars")
#> [1] '0.16.1'# Make some datapl_df<-pl$DataFrame(col1=letters, col2=1:26)
# Savepath<- tempfile(fileext="csv")
pl_df$write_csv(path)
# Compressgz_path<-R.utils::gzip(path)
# Try to read back - throws errorpl$read_csv(gz_path)
#> Error: Execution halted with the following contexts#> 0: In R: in pl$read_csv():#> 0: During function call [base::tryCatch(base::withCallingHandlers({#> NULL#> base::saveRDS(base::do.call(base::do.call, base::c(base::readRDS("C:\\Users\\jsmith79\\AppData\\Local\\Temp\\RtmpMbY9aJ\\callr-fun-98e475e83a42"), #> base::list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv, #> quote = TRUE), file = "C:\\Users\\jsmith79\\AppData\\Local\\Temp\\RtmpMbY9aJ\\callr-res-98e415445ef", #> compress = FALSE)#> base::flush(base::stdout())#> base::flush(base::stderr())#> NULL#> base::invisible()#> }, error = function(e) {#> {#> callr_data <- base::as.environment("tools:callr")$`__callr_data__`#> err <- callr_data$err#> if (FALSE) {#> base::assign(".Traceback", base::.traceback(4), envir = callr_data)#> utils::dump.frames("__callr_dump__")#> base::assign(".Last.dump", .GlobalEnv$`__callr_dump__`, #> envir = callr_data)#> base::rm("__callr_dump__", envir = .GlobalEnv)#> }#> e <- err$process_call(e)#> e2 <- err$new_error("error in callr subprocess")#> class <- base::class#> class(e2) <- base::c("callr_remote_error", class(e2))#> e2 <- err$add_trace_back(e2)#> cut <- base::which(e2$trace$scope == "global")[1]#> if (!base::is.na(cut)) {#> e2$trace <- e2$trace[-(1:cut), ]#> }#> base::saveRDS(base::list("error", e2, e), file = base::paste0("C:\\Users\\jsmith79\\AppData\\Local\\Temp\\RtmpMbY9aJ\\callr-res-98e415445ef", #> ".error"))#> }#> }, interrupt = function(e) {#> {#> callr_data <- base::as.environment("tools:callr")$`__callr_data__`#> err <- callr_data$err#> if (FALSE) {#> base::assign(".Traceback", base::.traceback(4), envir = callr_data)#> utils::dump.frames("__callr_dump__")#> base::assign(".Last.dump", .GlobalEnv$`__callr_dump__`, #> envir = callr_data)#> base::rm("__callr_dump__", envir = .GlobalEnv)#> }#> e <- err$process_call(e)#> e2 <- err$new_error("error in callr subprocess")#> class <- base::class#> class(e2) <- base::c("callr_remote_error", class(e2))#> e2 <- err$add_trace_back(e2)#> cut <- base::which(e2$trace$scope == "global")[1]#> if (!base::is.na(cut)) {#> e2$trace <- e2$trace[-(1:cut), ]#> }#> base::saveRDS(base::list("error", e2, e), file = base::paste0("C:\\Users\\jsmith79\\AppData\\Local\\Temp\\RtmpMbY9aJ\\callr-res-98e415445ef", #> ".error"))#> }#> }, callr_message = function(e) {#> base::try(base::signalCondition(e))#> }), error = function(e) {#> NULL#> if (FALSE) {#> base::try(base::stop(e))#> }#> else {#> base::invisible()#> }#> }, interrupt = function(e) {#> NULL#> if (FALSE) {#> e#> }#> else {#> base::invisible()#> }#> })]#> 1: Encountered the following error in Rust-Polars:#> cannot scan compressed csv; use `read_csv` for compressed data
Thanks for the report and the reprex, I confirm pl.read_csv() on this gzipped file works. We need to see in the python code if they have a special path for this kind of file
When using
pl$read_csv()
to read a gzipped file, an error message is thrown directing the user to "useread_csv
for compressed data" (which is what is being used). It looks likeread_csv
in R is just a wrapper aroundscan_csv
.scan_csv
can't be used for compressed data, so this error is thrown forread_csv
as well.I've added a reprex below. I think a previous version of r-polars let me use
read_csv
on compressed data, but I could be wrong; this could also be breaking change on the Rust side.Created on 2024-04-23 with reprex v2.1.0
Session info
The text was updated successfully, but these errors were encountered: