Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion r/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Imports:
utils,
vctrs
Roxygen: list(markdown = TRUE, r6 = FALSE, load = "source")
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to back this out + the extra docs changes, but they were stale on main.

Config/testthat/edition: 3
Config/build/bootstrap: TRUE
Suggests:
Expand Down
3 changes: 2 additions & 1 deletion r/R/arrow-info.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ arrow_with_json <- function() {
some_features_are_off <- function(features) {
# `features` is a named logical vector (as in arrow_info()$capabilities)
# Let's exclude some less relevant ones
blocklist <- c("lzo", "bz2", "brotli", "substrait")
# jemalloc is only included because it is sometimes disabled in our build process
blocklist <- c("lzo", "bz2", "brotli", "substrait", "jemalloc")
Comment on lines +142 to +143

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a little paranoid / silly, but we disable jemalloc in our own builds, and honestly if only jemalloc is off, but nothing else is, that's generally ok, so I would rather be less noisy so long as folks can read parquet

# Return TRUE if any of the other features are FALSE
!all(features[setdiff(names(features), blocklist)])
}
Expand Down
71 changes: 44 additions & 27 deletions r/R/arrow-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,37 +182,54 @@ configure_tzdb <- function() {
.onAttach <- function(libname, pkgname) {
# Just to be extra safe, let's wrap this in a try();
# we don't want a failed startup message to prevent the package from loading
try({
# On macOS only, Check if we are running in under emulation, and warn this will not work
if (on_rosetta()) {
packageStartupMessage(
paste(
"Warning:",
" It appears that you are running R and Arrow in emulation (i.e. you're",
" running an Intel version of R on a non-Intel mac). This configuration is",
" not supported by arrow, you should install a native (arm64) build of R",
" and use arrow with that. See https://cran.r-project.org/bin/macosx/",
"",
sep = "\n"
try(
{
Comment on lines +185 to +186

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styler apparently demands this now?. I can back it out if we don't like it, but came from make doc so we'll be fighting it if we do.

# On macOS only, Check if we are running in under emulation, and warn this will not work
if (on_rosetta()) {
packageStartupMessage(
paste(
"Warning:",
" It appears that you are running R and Arrow in emulation (i.e. you're",
" running an Intel version of R on a non-Intel mac). This configuration is",
" not supported by arrow, you should install a native (arm64) build of R",
" and use arrow with that. See https://cran.r-project.org/bin/macosx/",
"",
sep = "\n"
)
)
)
}
}


features <- arrow_info()$capabilities
# That has all of the #ifdef features, plus the compression libs and the
# string libraries (but not the memory allocators, they're added elsewhere)
#
# Let's print a message if some are off
if (some_features_are_off(features)) {
packageStartupMessage(
paste(
"Some features are not enabled in this build of Arrow.",
"Run `arrow_info()` for more information."
features <- arrow_info()$capabilities
# That has all of the #ifdef features, plus the compression libs and the
# string libraries (but not the memory allocators, they're added elsewhere)
#
# Let's print a message if some are off
if (some_features_are_off(features)) {
packageStartupMessage(
paste(
"Some features are not enabled in this build of Arrow.",
"Run `arrow_info()` for more information."
)
)
)
}
}, silent = TRUE)
# On macOS binaries from CRAN can be hobbled. They sometimes restrict access to our
# dependency source downloading even though we can build from source on their machines.
# They also refuse to allow libarrow binaries to be downloaded, so instead distribute
# hobbled arrow binaries
# If on macOS, and features are disabled, advise that reinstalling might help
if (identical(tolower(Sys.info()[["sysname"]]), "darwin")) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also check and confirm that the package was installed from CRAN here too if we wanted to be extra sure. Though we will also need to confirm that Posit Public Package Manager isn't also hosting bad binaries too if we do that, but if we leave this as a check on all macs, we have a slightly less strong push to confirm all non-CRANs are building on their own

packageStartupMessage(
paste0(
"The repository you retrieved Arrow from did not include all of Arrow's features.\n",
"You can install a fully-featured version by running:\n",
"`install.packages('arrow', repos = 'https://apache.r-universe.dev')`."
)
)
}
}
},
silent = TRUE
)
}

# Clean up the StopSource that was registered in .onLoad() so that if the
Expand Down
14 changes: 3 additions & 11 deletions r/R/install-arrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,14 @@ install_arrow <- function(nightly = FALSE,
ARROW_R_DEV = verbose,
ARROW_USE_PKG_CONFIG = use_system
)
# On the M1, we can't use the usual autobrew, which pulls Intel dependencies
apple_m1 <- grepl("arm-apple|aarch64.*darwin", R.Version()$platform)
# On Rosetta, we have to build without JEMALLOC, so we also can't autobrew
rosetta <- on_rosetta()
if (rosetta) {
# On Rosetta, we have to build without JEMALLOC
if (on_rosetta()) {
Sys.setenv(ARROW_JEMALLOC = "OFF")
}
if (apple_m1 || rosetta) {
Sys.setenv(FORCE_BUNDLED_BUILD = "true")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably also about autobrew right?

Suggested change
Sys.setenv(FORCE_BUNDLED_BUILD = "true")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure it is, but when I git blamed it wasn't clear that's the only reason for it. I can pull it out, but also we probably should just remove all of the rosetta building code entirely at some point since it's not really a supported setup. I'll add an issue to come back to this (+ various other places we have it)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

opts <- list()
if (apple_m1 || rosetta) {
# Skip binaries (esp. for rosetta)
opts$pkgType <- "source"
} else if (isTRUE(binary)) {
if (isTRUE(binary)) {
# Unless otherwise directed, don't consider newer source packages when
# options(pkgType) == "both" (default on win/mac)
opts$install.packages.check.source <- "no"
Expand Down
4 changes: 2 additions & 2 deletions r/man/arrow-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions r/man/format_schema.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.