Apache DataFusion SQL Query Engine
ARROW-6793: [R] Arrow C++ binary packaging for Linux
Neal Richardson27e2f74bf963
diff --git a/.env b/.envindex ccaecc9ea8..7deac551dc 100644--- a/.env+++ b/.env@@ -30,7 +30,6 @@ GO=1.12NODE=11MAVEN=3.5.4JDK=8-R=3.6.1PANDAS=latestDASK=latestTURBODBC=latest@@ -38,3 +37,7 @@ HDFS=2.9.2SPARK=masterDOTNET=2.1R=3.6+# These correspond to images on Docker Hub that contain R, e.g. rhub/ubuntu-gcc-release:latest+R_ORG=rhub+R_IMAGE=ubuntu-gcc-release+R_TAG=latestdiff --git a/.github/workflows/dev_cron.yml b/.github/workflows/dev_cron.ymlindex 8c74ceb86c..afbb96ac7d 100644--- a/.github/workflows/dev_cron.yml+++ b/.github/workflows/dev_cron.yml@@ -18,6 +18,12 @@name: Dev Cronon:+ push:+ paths:+ - '.github/workflows/dev_cron.yml'+ pull_request:+ paths:+ - '.github/workflows/dev_cron.yml'schedule:- cron: |*/15 * * * *diff --git a/.github/workflows/r.yml b/.github/workflows/r.ymlindex 18d2ba8f26..fda436759d 100644--- a/.github/workflows/r.yml+++ b/.github/workflows/r.yml@@ -32,7 +32,6 @@ on:- 'r/**'jobs:-ubuntu:name: AMD64 Ubuntu ${{ matrix.ubuntu }} R ${{ matrix.r }}runs-on: ubuntu-latest@@ -71,34 +70,32 @@ jobs:-p ${{ secrets.DOCKERHUB_TOKEN }}docker-compose push ubuntu-r- conda:- name: AMD64 Conda R ${{ matrix.r }}+ rstudio:+ name: "rstudio/r-base:${{ matrix.r_version }}-${{ matrix.r_image }}"runs-on: ubuntu-latest- if: github.event_name == 'push'strategy:fail-fast: falsematrix:- r: [3.6]+ # See https://hub.docker.com/r/rstudio/r-base+ r_version: ["3.6"]+ r_image:+ - centos7env:- R: ${{ matrix.r }}+ R_ORG: "rstudio"+ R_IMAGE: "r-base"+ R_TAG: ${{ matrix.r_version }}-${{ matrix.r_image }}steps:- name: Checkout Arrowuses: actions/checkout@v1- with:- submodules: true- name: Docker Pullshell: bash- run: |- docker-compose pull --ignore-pull-failures conda-cpp- docker-compose pull --ignore-pull-failures conda-r+ run: docker-compose pull --ignore-pull-failures r- name: Docker Buildshell: bash- run: |- docker-compose build conda-cpp- docker-compose build conda-r+ run: docker-compose build r- name: Docker Runshell: bash- run: docker-compose run conda-r+ run: docker-compose run r- name: Docker Pushif: success() && github.event_name == 'push' && github.repository == 'apache/arrow'continue-on-error: true@@ -106,4 +103,4 @@ jobs:run: |docker login -u ${{ secrets.DOCKERHUB_USER }} \-p ${{ secrets.DOCKERHUB_TOKEN }}- docker-compose push conda-r+ docker-compose push rdiff --git a/ci/docker/linux-apt-r.dockerfile b/ci/docker/linux-apt-r.dockerfileindex 15320a63e7..100a1f4c01 100644--- a/ci/docker/linux-apt-r.dockerfile+++ b/ci/docker/linux-apt-r.dockerfile@@ -54,16 +54,10 @@ RUN apt-get update -y && \# Ensure parallel R package installation, set CRAN repo mirror,# and use pre-built binaries where possible-RUN printf "\- options(Ncpus = parallel::detectCores(), \- repos = 'https://demo.rstudiopm.com/all/__linux__/"$(lsb_release -cs)"/latest', \- HTTPUserAgent = sprintf(\- 'R/%%s R (%%s)', getRversion(), \- paste(getRversion(), R.version\$platform, R.version\$arch, R.version\$os)))\n" \- >> /etc/R/Rprofile.site-+COPY ci/etc/rprofile /arrow/ci/etc/+RUN cat /arrow/ci/etc/rprofile >> $(R RHOME)/etc/Rprofile.site# Also ensure parallel compilation of C/C++ code-RUN echo "MAKEFLAGS=-j$(R --slave -e 'cat(parallel::detectCores())')" >> /usr/lib/R/etc/Makeconf+RUN echo "MAKEFLAGS=-j$(R --slave -e 'cat(parallel::detectCores())')" >> $(R RHOME)/etc/MakeconfCOPY ci/scripts/r_deps.sh /arrow/ci/scripts/COPY r/DESCRIPTION /arrow/r/diff --git a/ci/docker/linux-r.dockerfile b/ci/docker/linux-r.dockerfilenew file mode 100644index 0000000000..d23b802c55--- /dev/null+++ b/ci/docker/linux-r.dockerfile@@ -0,0 +1,37 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++# General purpose Dockerfile to take a Docker image containing R+# and install Arrow R package dependencies++ARG base+FROM ${base}++# Make sure R is on the path for the R-hub devel versions (where RPREFIX is set in its dockerfile)+ENV PATH "${RPREFIX}/bin:${PATH}"+# Ensure parallel R package installation, set CRAN repo mirror,+# and use pre-built binaries where possible+COPY ci/etc/rprofile /arrow/ci/etc/+RUN cat /arrow/ci/etc/rprofile >> $(R RHOME)/etc/Rprofile.site+# Also ensure parallel compilation of C/C++ code+RUN echo "MAKEFLAGS=-j$(R --slave -e 'cat(parallel::detectCores())')" >> $(R RHOME)/etc/Makeconf+# Workaround for html help install failure; see https://github.com/r-lib/devtools/issues/2084#issuecomment-530912786+RUN Rscript -e 'x <- file.path(R.home("doc"), "html"); if (!file.exists(x)) {dir.create(x, recursive=TRUE); file.copy(system.file("html/R.css", package="stats"), x)}'++COPY ci/scripts/r_deps.sh /arrow/ci/scripts/+COPY r/DESCRIPTION /arrow/r/+RUN /arrow/ci/scripts/r_deps.sh /arrowdiff --git a/ci/etc/rprofile b/ci/etc/rprofilenew file mode 100644index 0000000000..8b7e401388--- /dev/null+++ b/ci/etc/rprofile@@ -0,0 +1,51 @@+.pick_cran <- function() {+ # Return a CRAN repo URL, preferring RSPM binaries if available for this OS+ rspm_template <- "https://demo.rstudiopm.com/all/__linux__/%s/latest"+ supported_os <- c("xenial", "bionic", "centos7", "opensuse42", "opensuse15")++ if (nzchar(Sys.which("lsb_release"))) {+ os <- tolower(system("lsb_release -cs", intern = TRUE))+ if (os %in% supported_os) {+ return(sprintf(rspm_template, os))+ }+ }+ if (file.exists("/etc/os-release")) {+ os_release <- readLines("/etc/os-release")+ vals <- sub("^.*=(.*)$", "\\1", os_release)+ os <- intersect(vals, supported_os)+ if (length(os)) {+ # e.g. "bionic"+ return(sprintf(rspm_template, os))+ } else {+ names(vals) <- sub("^(.*)=.*$", "\\1", os_release)+ if (vals["ID"] == "opensuse") {+ version <- sub('^"?([0-9]+).*"?.*$', "\\1", vals["VERSION_ID"])+ os <- paste0("opensuse", version)+ if (os %in% supported_os) {+ return(sprintf(rspm_template, os))+ }+ }+ }+ }+ if (file.exists("/etc/system-release")) {+ # Something like "CentOS Linux release 7.7.1908 (Core)"+ system_release <- tolower(utils::head(readLines("/etc/system-release"), 1))+ # Extract from that the distro and the major version number+ os <- sub("^([a-z]+) .* ([0-9]+).*$", "\\1\\2", system_release)+ if (os %in% supported_os) {+ return(sprintf(rspm_template, os))+ }+ }++ return("https://cloud.r-project.org")+}++options(+ Ncpus = parallel::detectCores(),+ repos = tryCatch(.pick_cran(), error = function(e) "https://cloud.r-project.org"),+ HTTPUserAgent = sprintf(+ 'R/%s R (%s)',+ getRversion(),+ paste(getRversion(), R.version$platform, R.version$arch, R.version$os)+ )+)diff --git a/dev/release/rat_exclude_files.txt b/dev/release/rat_exclude_files.txtindex deadc82abc..ea54278ede 100644--- a/dev/release/rat_exclude_files.txt+++ b/dev/release/rat_exclude_files.txt@@ -8,6 +8,7 @@*.json*.snap.github/ISSUE_TEMPLATE.md+ci/etc/rprofilecpp/CHANGELOG_PARQUET.mdcpp/src/arrow/io/mman.hcpp/src/arrow/util/random.hdiff --git a/dev/tasks/r/azure.linux.yml b/dev/tasks/r/azure.linux.ymlnew file mode 100644index 0000000000..94ddc08d26--- /dev/null+++ b/dev/tasks/r/azure.linux.yml@@ -0,0 +1,50 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.++jobs:+- job: linux+ pool:+ vmImage: ubuntu-latest+ timeoutInMinutes: 360+ steps:+ - script: |+ set -ex+ git clone --no-checkout {{ arrow.remote }} arrow+ git -C arrow fetch -t {{ arrow.remote }} {{ arrow.branch }}+ git -C arrow checkout FETCH_HEAD+ git -C arrow submodule update --init --recursive+ displayName: Clone arrow++ - script: |+ set -ex+ docker -v+ docker-compose -v+ cd arrow+ R_ORG={{ r_org }}+ R_IMAGE={{ r_image }}+ R_TAG={{ r_tag }}+ docker-compose pull --ignore-pull-failures r+ docker-compose build r+ displayName: Docker build++ - script: |+ set -ex+ cd arrow+ R_ORG={{ r_org }}+ R_IMAGE={{ r_image }}+ R_TAG={{ r_tag }}+ docker-compose run r+ displayName: Docker rundiff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.ymlindex af59d8cb46..884072e8f5 100644--- a/dev/tasks/tasks.yml+++ b/dev/tasks/tasks.yml@@ -111,6 +111,12 @@ groups:- test-debian-10-python-3- test-ubuntu-18.04-python-3- test-fedora-29-python-3+ - test-r-rhub-ubuntu-gcc-release+ - test-r-rhub-debian-gcc-devel+ - test-r-rstudio-r-base-3.6-bionic+ - test-r-rstudio-r-base-3.6-centos6+ - test-r-rstudio-r-base-3.6-opensuse15+ - test-r-rstudio-r-base-3.6-opensuse42- test-ubuntu-18.04-r-3.6- test-conda-r-3.6- test-ubuntu-18.04-r-sanitizer@@ -151,6 +157,12 @@ groups:- test-debian-10-python-3- test-ubuntu-18.04-python-3- test-fedora-29-python-3+ - test-r-rhub-ubuntu-gcc-release+ - test-r-rhub-debian-gcc-devel+ - test-r-rstudio-r-base-3.6-bionic+ - test-r-rstudio-r-base-3.6-centos6+ - test-r-rstudio-r-base-3.6-opensuse15+ - test-r-rstudio-r-base-3.6-opensuse42- test-ubuntu-18.04-r-3.6- test-conda-r-3.6- test-ubuntu-18.04-r-sanitizer@@ -181,9 +193,15 @@ groups:- test-fedora-29-python-3r:- - test-ubuntu-18.04-r-3.6- test-conda-r-3.6- test-ubuntu-18.04-r-sanitizer+ - test-r-rhub-ubuntu-gcc-release+ - test-r-rhub-debian-gcc-devel+ - test-r-rstudio-r-base-3.6-bionic+ - test-r-rstudio-r-base-3.6-centos6+ - test-r-rstudio-r-base-3.6-opensuse15+ - test-r-rstudio-r-base-3.6-opensuse42+ - macos-r-autobrewruby:- test-debian-ruby@@ -271,7 +289,12 @@ groups:- test-debian-10-python-3- test-ubuntu-18.04-python-3- test-fedora-29-python-3- - test-ubuntu-18.04-r-3.6+ - test-r-rhub-ubuntu-gcc-release+ - test-r-rhub-debian-gcc-devel+ - test-r-rstudio-r-base-3.6-bionic+ - test-r-rstudio-r-base-3.6-centos6+ - test-r-rstudio-r-base-3.6-opensuse15+ - test-r-rstudio-r-base-3.6-opensuse42- test-conda-r-3.6- test-ubuntu-18.04-r-sanitizer- test-debian-10-go-1.12@@ -1907,6 +1930,60 @@ tasks:- docker-compose build fedora-python- docker-compose run fedora-python+ test-r-rhub-debian-gcc-devel:+ ci: azure+ platform: linux+ template: r/azure.linux.yml+ params:+ r_org: rhub+ r_image: debian-gcc-devel+ r_tag: latest++ test-r-rhub-ubuntu-gcc-release:+ ci: azure+ platform: linux+ template: r/azure.linux.yml+ params:+ r_org: rhub+ r_image: ubuntu-gcc-release+ r_tag: latest++ test-r-rstudio-r-base-3.6-bionic:+ ci: azure+ platform: linux+ template: r/azure.linux.yml+ params:+ r_org: rstudio+ r_image: r-base+ r_tag: 3.6-bionic++ test-r-rstudio-r-base-3.6-centos6:+ ci: azure+ platform: linux+ template: r/azure.linux.yml+ params:+ r_org: rstudio+ r_image: r-base+ r_tag: 3.6-centos6++ test-r-rstudio-r-base-3.6-opensuse15:+ ci: azure+ platform: linux+ template: r/azure.linux.yml+ params:+ r_org: rstudio+ r_image: r-base+ r_tag: 3.6-opensuse15++ test-r-rstudio-r-base-3.6-opensuse42:+ ci: azure+ platform: linux+ template: r/azure.linux.yml+ params:+ r_org: rstudio+ r_image: r-base+ r_tag: 3.6-opensuse24+test-ubuntu-18.04-r-3.6:ci: circleplatform: linuxdiff --git a/docker-compose.yml b/docker-compose.ymlindex 6bf5f67e73..6c2904e3bc 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -662,6 +662,35 @@ services:/arrow/ci/scripts/cpp_build.sh /arrow /build &&/arrow/ci/scripts/r_test.sh /arrow"+ r:+ # This lets you test building/installing the arrow R package+ # (including building the C++ library) on any Docker image that contains R+ #+ # Usage:+ # R_ORG=rhub R_IMAGE=ubuntu-gcc-release R_TAG=latest docker-compose build r+ # R_ORG=rhub R_IMAGE=ubuntu-gcc-release R_TAG=latest docker-compose run r+ image: ${REPO}:r-${R_ORG}-${R_IMAGE}-${R_TAG}+ build:+ context: .+ dockerfile: ci/docker/linux-r.dockerfile+ cache_from:+ - ${REPO}:r-${R_ORG}-${R_IMAGE}-${R_TAG}+ args:+ base: ${R_ORG}/${R_IMAGE}:${R_TAG}+ shm_size: *shm-size+ environment:+ TEST_R_WITH_ARROW: "true"+ NOT_CRAN: "true"+ LIBARROW_DOWNLOAD: "false"+ volumes:+ - .:/arrow:delegated+ command: >+ /bin/bash -c "+ cd /arrow/r &&+ R CMD INSTALL . &&+ cd tests &&+ R --no-save --no-restore -e 'library(testthat); library(arrow); library(tibble); test_check(\"arrow\", reporter = \"summary\", stop_on_warning = TRUE)'"+ubuntu-r-sanitizer:# Only 18.04 and amd64 supported# Usage: