Skip to content

Commit

Permalink
Merge pull request #113 from molgenis/fix/arrow
Browse files Browse the repository at this point in the history
fix: move arrow to suggests to not depend on it
  • Loading branch information
marikaris authored Feb 8, 2024
2 parents c93f1cb + c002e02 commit 1985a25
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: MolgenisArmadillo
Type: Package
Version: 2.1.4
Version: 2.3.3
Title: Armadillo Client for the Armadillo Service
Description: A set of functions to manage data shared on a
'MOLGENIS Armadillo' server.
Expand Down Expand Up @@ -45,9 +45,9 @@ Imports:
tidyr,
tibble,
MolgenisAuth (>= 0.0.25),
arrow,
rlist
Suggests:
arrow,
stringi,
withr,
knitr,
Expand All @@ -64,3 +64,4 @@ BugReports: https://github.com/molgenis/molgenis-r-armadillo/issues/
RoxygenNote: 7.2.3
VignetteBuilder: knitr
Encoding: UTF-8
Additional_repositories: https://apache.r-universe.dev/builds,https://nightlies.apache.org/arrow/r/
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ export(armadillo.upload_table)
import(rlist)
importFrom(MolgenisAuth,device_flow_auth)
importFrom(MolgenisAuth,discover)
importFrom(arrow,read_parquet)
importFrom(arrow,write_parquet)
importFrom(base64enc,base64encode)
importFrom(dplyr,"%>%")
importFrom(dplyr,any_of)
Expand Down
21 changes: 18 additions & 3 deletions R/table.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ armadillo.upload_table <- function(project, folder, table, name = NULL) { # noli
#' @return the extension of the file
#'
.compress_table <- function(table, file) {
arrow::write_parquet(table, file)
".parquet"
tryCatch(
{
arrow::write_parquet(table, file)
".parquet"
},
error = function(cond) {
stop("Arrow isn't loaded")
})
}


#' List the tables in a project
#'
Expand Down Expand Up @@ -142,7 +149,15 @@ armadillo.load_table <- function(project, folder, name) { # nolint
#' @return the contents of the file, as data frame
#'
.load_table <- function(file) {
as.data.frame(arrow::read_parquet(file, as_data_frame = FALSE))
tryCatch(
{
as.data.frame(arrow::read_parquet(file, as_data_frame = FALSE))
},
error = function(cond) {
stop("Arrow isn't loaded")
}
)

}

#' Move the table
Expand Down

0 comments on commit 1985a25

Please sign in to comment.