diff --git a/.env b/.env index 579895e2d61..0af36084bd7 100644 --- a/.env +++ b/.env @@ -66,6 +66,7 @@ GCC_VERSION="" R_ORG=rhub R_IMAGE=ubuntu-gcc-release R_TAG=latest +TZ=UTC # -1 does not attempt to install a devtoolset version, any positive integer will install devtoolset-n DEVTOOLSET_VERSION=-1 diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index e1647807cef..d7e3b67bc4b 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -89,7 +89,9 @@ jobs: run: | sudo sysctl -w kernel.core_pattern="core.%e.%p" ulimit -c unlimited - archery docker run ubuntu-r + # Setting a non-default and non-probable Marquesas French Polynesia time + # it has both with a .45 offset and very very few people who live there. + archery docker run -e TZ=MART ubuntu-r - name: Dump install logs run: cat r/check/arrow.Rcheck/00install.out if: always() @@ -147,7 +149,10 @@ jobs: run: | sudo sysctl -w kernel.core_pattern="core.%e.%p" ulimit -c unlimited - archery docker run r + # Don't set a TZ here to test that case. These builds will have the following warning in them: + # System has not been booted with systemd as init system (PID 1). Can't operate. + # Failed to connect to bus: Host is down + archery docker run -e TZ="" r - name: Dump install logs run: cat r/check/arrow.Rcheck/00install.out if: always() diff --git a/ci/docker/linux-apt-r.dockerfile b/ci/docker/linux-apt-r.dockerfile index 36f4fb24aba..97029ce62ad 100644 --- a/ci/docker/linux-apt-r.dockerfile +++ b/ci/docker/linux-apt-r.dockerfile @@ -19,6 +19,9 @@ ARG base FROM ${base} ARG arch +ARG tz="UTC" +ENV TZ=${tz} + # Build R # [1] https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04 # [2] https://linuxize.com/post/how-to-install-r-on-ubuntu-18-04/#installing-r-packages-from-cran diff --git a/ci/docker/linux-r.dockerfile b/ci/docker/linux-r.dockerfile index ac414829d42..a501d69955c 100644 --- a/ci/docker/linux-r.dockerfile +++ b/ci/docker/linux-r.dockerfile @@ -30,6 +30,9 @@ ENV ARROW_R_DEV=${r_dev} ARG devtoolset_version=-1 ENV DEVTOOLSET_VERSION=${devtoolset_version} +ARG tz="UTC" +ENV TZ=${tz} + # 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}" diff --git a/docker-compose.yml b/docker-compose.yml index 6b435e8da5d..c842ee9f0ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1011,6 +1011,7 @@ services: r: ${R} base: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-cpp gcc_version: ${GCC_VERSION} + tz: ${TZ} shm_size: *shm-size environment: <<: *ccache @@ -1048,6 +1049,7 @@ services: base: ${R_ORG}/${R_IMAGE}:${R_TAG} r_dev: ${ARROW_R_DEV} devtoolset_version: ${DEVTOOLSET_VERSION} + tz: ${TZ} shm_size: *shm-size environment: LIBARROW_DOWNLOAD: "false" @@ -1078,6 +1080,7 @@ services: args: base: wch1/r-debug:latest r_bin: RDsan + tz: ${TZ} environment: <<: *ccache volumes: *ubuntu-volumes @@ -1099,6 +1102,7 @@ services: args: base: wch1/r-debug:latest r_bin: RDvalgrind + tz: ${TZ} environment: <<: *ccache ARROW_R_DEV: ${ARROW_R_DEV} @@ -1123,6 +1127,7 @@ services: args: base: rstudio/r-base:4.0-focal r_dev: ${ARROW_R_DEV} + tz: ${TZ} shm_size: *shm-size environment: LIBARROW_DOWNLOAD: "true" diff --git a/r/tests/testthat/test-Array.R b/r/tests/testthat/test-Array.R index a86bdf0add4..63ac64eee5f 100644 --- a/r/tests/testthat/test-Array.R +++ b/r/tests/testthat/test-Array.R @@ -279,9 +279,9 @@ test_that("Timezone handling in Arrow roundtrip (ARROW-3543)", { # Write a feather file as that's what the initial bug report used df <- tibble::tibble( no_tz = lubridate::ymd_hms("2018-10-07 19:04:05") + 1:10, - yes_tz = lubridate::ymd_hms("2018-10-07 19:04:05", tz = "Asia/Pyongyang") + 1:10 + yes_tz = lubridate::ymd_hms("2018-10-07 19:04:05", tz = "Pacific/Marquesas") + 1:10 ) - if (!identical(Sys.timezone(), "Asia/Pyongyang")) { + if (!identical(Sys.timezone(), "Pacific/Marquesas")) { # Confirming that the columns are in fact different expect_false(any(df$no_tz == df$yes_tz)) } diff --git a/r/tests/testthat/test-data-type.R b/r/tests/testthat/test-data-type.R index 25c0dd5fc9f..84c75451eaa 100644 --- a/r/tests/testthat/test-data-type.R +++ b/r/tests/testthat/test-data-type.R @@ -413,7 +413,7 @@ test_that("FixedSizeBinary", { }) test_that("DataType to C-interface", { - datatype <- timestamp("ms", timezone = "Asia/Pyongyang") + datatype <- timestamp("ms", timezone = "Pacific/Marquesas") # export the datatype via the C-interface ptr <- allocate_arrow_schema() diff --git a/r/tests/testthat/test-dplyr-lubridate.R b/r/tests/testthat/test-dplyr-lubridate.R index d01afc86fef..2d9cfe6ea52 100644 --- a/r/tests/testthat/test-dplyr-lubridate.R +++ b/r/tests/testthat/test-dplyr-lubridate.R @@ -32,7 +32,7 @@ test_df <- tibble::tibble(date = test_date) # We can support this feature after ARROW-12980 is merged test_that("timezone aware timestamps are not supported", { - tz_aware_date <- as.POSIXct("2017-01-01 00:00:12.3456789", tz = "Asia/Pyongyang") + tz_aware_date <- as.POSIXct("2017-01-01 00:00:12.3456789", tz = "Pacific/Marquesas") tz_aware_df <- tibble::tibble(date = tz_aware_date) expect_error( diff --git a/r/tests/testthat/test-python.R b/r/tests/testthat/test-python.R index c7bedc518ef..7efc2b28715 100644 --- a/r/tests/testthat/test-python.R +++ b/r/tests/testthat/test-python.R @@ -97,7 +97,7 @@ test_that("Table with metadata roundtrip", { }) test_that("DataType roundtrip", { - r <- timestamp("ms", timezone = "Asia/Pyongyang") + r <- timestamp("ms", timezone = "Pacific/Marquesas") py <- reticulate::r_to_py(r) expect_s3_class(py, "pyarrow.lib.DataType") expect_equal(reticulate::py_to_r(py), r)