Skip to content

Commit 1440d5a

Browse files
karldwianmcook
authored andcommitted
ARROW-13768: [R] Allow JSON to be an optional component
I templated from ARROW-11735. Let's see how all the tests go! Closes apache#11046 from karldw/arrow-12981 Authored-by: karldw <karldw@users.noreply.github.com> Signed-off-by: Ian Cook <ianmcook@gmail.com>
1 parent a1d207e commit 1440d5a

18 files changed

Lines changed: 505 additions & 464 deletions

File tree

‎dev/tasks/conda-recipes/r-arrow/configure.win‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -euxo pipefail
44

55
# Remove the -I../inst/include/ when unvendoring cpp11 in ARROW-13610
6-
echo "PKG_CPPFLAGS=-DNDEBUG -I\"${LIBRARY_PREFIX}/include\" -I\"${PREFIX}/include\" -DARROW_R_WITH_ARROW -DARROW_R_WITH_PARQUET -DARROW_R_WITH_DATASET -DARROW_R_WITH_S3 -I../inst/include/" > src/Makevars.win
6+
echo "PKG_CPPFLAGS=-DNDEBUG -I\"${LIBRARY_PREFIX}/include\" -I\"${PREFIX}/include\" -DARROW_R_WITH_ARROW -DARROW_R_WITH_PARQUET -DARROW_R_WITH_DATASET -DARROW_R_WITH_S3 -DARROW_R_WITH_JSON -I../inst/include/" > src/Makevars.win
77
echo "PKG_CXXFLAGS=\$(CXX_VISIBILITY)" >> src/Makevars.win
88
echo 'CXX_STD=CXX11' >> src/Makevars.win
99
echo "PKG_LIBS=-L\"${LIBRARY_PREFIX}/lib\" -larrow_dataset -lparquet -larrow" >> src/Makevars.win

‎dev/tasks/r/azure.linux.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
{{ flags|default("") }} \
5555
-e ARROW_DATASET={{ arrow_dataset|default("") }} \
5656
-e ARROW_PARQUET={{ arrow_parquet|default("") }} \
57+
-e ARROW_JSON={{ arrow_json|default("") }} \
5758
-e ARROW_S3={{ arrow_s3|default("") }} \
5859
-e ARROW_WITH_RE2={{ arrow_with_re2|default("") }} \
5960
-e ARROW_WITH_UTF8PROC={{ arrow_with_utf8proc|default("") }} \

‎dev/tasks/tasks.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,7 @@ tasks:
11031103
r_tag: latest
11041104
arrow_dataset: "OFF"
11051105
arrow_parquet: "OFF"
1106+
arrow_json: "OFF"
11061107
arrow_s3: "OFF"
11071108
arrow_with_re2: "OFF"
11081109
arrow_with_utf8proc: "OFF"

‎r/NAMESPACE‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export(UnionDataset)
187187
export(arrow_available)
188188
export(arrow_info)
189189
export(arrow_with_dataset)
190+
export(arrow_with_json)
190191
export(arrow_with_parquet)
191192
export(arrow_with_s3)
192193
export(binary)

‎r/R/arrow-package.R‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@
105105
#' * The Arrow C++ library (check with `arrow_available()`)
106106
#' * Arrow Dataset support enabled (check with `arrow_with_dataset()`)
107107
#' * Parquet support enabled (check with `arrow_with_parquet()`)
108+
#' * JSON support enabled (check with `arrow_with_json()`)
108109
#' * Amazon S3 support enabled (check with `arrow_with_s3()`)
109110
#' @export
110111
#' @examples
111112
#' arrow_available()
112113
#' arrow_with_dataset()
113114
#' arrow_with_parquet()
115+
#' arrow_with_json()
114116
#' arrow_with_s3()
115117
#' @seealso If any of these are `FALSE`, see
116118
#' `vignette("install", package = "arrow")` for guidance on reinstalling the
@@ -145,6 +147,14 @@ arrow_with_s3 <- function() {
145147
})
146148
}
147149

150+
#' @rdname arrow_available
151+
#' @export
152+
arrow_with_json <- function() {
153+
tryCatch(.Call(`_json_available`), error = function(e) {
154+
return(FALSE)
155+
})
156+
}
157+
148158
option_use_threads <- function() {
149159
!is_false(getOption("arrow.use_threads"))
150160
}
@@ -174,6 +184,7 @@ arrow_info <- function() {
174184
capabilities = c(
175185
dataset = arrow_with_dataset(),
176186
parquet = arrow_with_parquet(),
187+
json = arrow_with_json(),
177188
s3 = arrow_with_s3(),
178189
utf8proc = "utf8_upper" %in% compute_funcs,
179190
re2 = "replace_substring_regex" %in% compute_funcs,

‎r/R/json.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#'
2626
#' @return A `data.frame`, or a Table if `as_data_frame = FALSE`.
2727
#' @export
28-
#' @examplesIf arrow_available()
28+
#' @examplesIf arrow_with_json()
2929
#' tf <- tempfile()
3030
#' on.exit(unlink(tf))
3131
#' writeLines('

‎r/configure‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ if [ $? -eq 0 ]; then
267267
BUNDLED_LIBS="$BUNDLED_LIBS -lssl -lcrypto -lcurl"
268268
fi
269269
fi
270+
# Check for JSON
271+
grep 'set(ARROW_JSON "ON")' $ARROW_OPTS_CMAKE >/dev/null 2>&1
272+
if [ $? -eq 0 ]; then
273+
PKG_CFLAGS="$PKG_CFLAGS -DARROW_R_WITH_JSON"
274+
fi
270275
# prepend PKG_DIRS and append BUNDLED_LIBS to PKG_LIBS
271276
PKG_LIBS="$PKG_DIRS $PKG_LIBS $BUNDLED_LIBS"
272277
echo "PKG_CFLAGS=$PKG_CFLAGS"

‎r/configure.win‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ AWS_LIBS="-laws-cpp-sdk-config -laws-cpp-sdk-transfer -laws-cpp-sdk-identity-man
4949

5050
# NOTE: If you make changes to the libraries below, you should also change
5151
# ci/scripts/r_windows_build.sh and ci/scripts/PKGBUILD
52-
PKG_CFLAGS="-I${RWINLIB}/include -DARROW_STATIC -DPARQUET_STATIC -DARROW_DS_STATIC -DARROW_R_WITH_ARROW -DARROW_R_WITH_PARQUET -DARROW_R_WITH_DATASET"
52+
PKG_CFLAGS="-I${RWINLIB}/include -DARROW_STATIC -DPARQUET_STATIC -DARROW_DS_STATIC -DARROW_R_WITH_ARROW -DARROW_R_WITH_PARQUET -DARROW_R_WITH_DATASET -DARROW_R_WITH_JSON"
5353
PKG_LIBS="-L${RWINLIB}/lib"'$(subst gcc,,$(COMPILED_BY))$(R_ARCH) '"-L${RWINLIB}/lib"'$(R_ARCH)$(CRT) '"-lparquet -larrow_dataset -larrow -larrow_bundled_dependencies -lutf8proc -lthrift -lsnappy -lz -lzstd -llz4 -lole32 ${MIMALLOC_LIBS} ${OPENSSL_LIBS}"
5454

5555
# S3 and re2 support only for Rtools40 (i.e. R >= 4.0)

‎r/data-raw/codegen.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
# Ensure that all machines are sorting the same way
4545
invisible(Sys.setlocale("LC_COLLATE", "C"))
4646

47-
features <- c("arrow", "dataset", "parquet", "s3")
47+
features <- c("arrow", "dataset", "parquet", "s3", "json")
4848

4949
suppressPackageStartupMessages({
5050
library(decor)

‎r/inst/build_arrow_static.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ${CMAKE} -DARROW_BOOST_USE_SHARED=OFF \
5959
-DARROW_FILESYSTEM=ON \
6060
-DARROW_JEMALLOC=${ARROW_JEMALLOC:-$ARROW_DEFAULT_PARAM} \
6161
-DARROW_MIMALLOC=${ARROW_MIMALLOC:-ON} \
62-
-DARROW_JSON=ON \
62+
-DARROW_JSON=${ARROW_JSON:-ON} \
6363
-DARROW_PARQUET=${ARROW_PARQUET:-ON} \
6464
-DARROW_S3=${ARROW_S3:-$ARROW_DEFAULT_PARAM} \
6565
-DARROW_WITH_BROTLI=${ARROW_WITH_BROTLI:-$ARROW_DEFAULT_PARAM} \

0 commit comments

Comments
 (0)