You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/01/24 12:26:44 UTC
[GitHub] HyukjinKwon commented on a change in pull request #22954:
[WIP][SPARK-25981][R] Enables Arrow optimization from R DataFrame to Spark
DataFrame
HyukjinKwon commented on a change in pull request #22954: [WIP][SPARK-25981][R] Enables Arrow optimization from R DataFrame to Spark DataFrame
URL: https://github.com/apache/spark/pull/22954#discussion_r250585248
##########
File path: R/pkg/R/SQLContext.R
##########
@@ -147,6 +147,89 @@ getDefaultSqlSource <- function() {
l[["spark.sql.sources.default"]]
}
+writeToFileInArrow <- function(fileName, rdf, numPartitions) {
+ requireNamespace1 <- requireNamespace
+
+ # For some reasons, Arrow R API requires to load 'defer_parent' which is from 'withr' package.
+ # This is a workaround to avoid this error. Otherwise, we should directly load 'withr'
+ # package, which CRAN complains about.
+ defer_parent <- function(x, ...) {
+ if (requireNamespace1("withr", quietly = TRUE)) {
+ defer_parent <- get("defer_parent", envir = asNamespace("withr"), inherits = FALSE)
+ defer_parent(x, ...)
+ } else {
+ stop("'withr' package should be installed.")
+ }
+ }
+
+ # R API in Arrow is not yet released. CRAN requires to add the package in requireNamespace
+ # at DESCRIPTION. Later, CRAN checks if the package is available or not. Therefore, it works
+ # around by avoiding direct requireNamespace.
+ if (requireNamespace1("arrow", quietly = TRUE)) {
+ record_batch <- get("record_batch", envir = asNamespace("arrow"), inherits = FALSE)
+ record_batch_stream_writer <- get(
+ "record_batch_stream_writer", envir = asNamespace("arrow"), inherits = FALSE)
Review comment:
FWIW, sparklyr and arrow implementation uses the same trick to avoid CRAN failure.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org