From 02635cf41b04ec89628b5653f59b5952940df3d7 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Mon, 12 Jul 2021 10:09:51 -0500 Subject: [PATCH 1/9] add TZ env var --- .env | 1 + 1 file changed, 1 insertion(+) diff --git a/.env b/.env index 579895e2d61..545b06f63d0 100644 --- a/.env +++ b/.env @@ -62,6 +62,7 @@ DOTNET=3.1 R=4.1 ARROW_R_DEV=TRUE GCC_VERSION="" +TZ UTC # 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 From 3cdfc07fb7dd5335c2c1f2fc9852f572e212eec7 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Mon, 12 Jul 2021 10:39:06 -0500 Subject: [PATCH 2/9] oops --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 545b06f63d0..9e51edb9fb7 100644 --- a/.env +++ b/.env @@ -62,7 +62,7 @@ DOTNET=3.1 R=4.1 ARROW_R_DEV=TRUE GCC_VERSION="" -TZ UTC +TZ=UTC # 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 From 57d01bdef3745d7092fa2932461c54dafadeda31 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Mon, 12 Jul 2021 12:16:06 -0500 Subject: [PATCH 3/9] in a different place --- .env | 1 - ci/docker/linux-apt-r.dockerfile | 4 +++- ci/docker/linux-r.dockerfile | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 9e51edb9fb7..579895e2d61 100644 --- a/.env +++ b/.env @@ -62,7 +62,6 @@ DOTNET=3.1 R=4.1 ARROW_R_DEV=TRUE GCC_VERSION="" -TZ=UTC # 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 diff --git a/ci/docker/linux-apt-r.dockerfile b/ci/docker/linux-apt-r.dockerfile index 36f4fb24aba..a528ee11c7a 100644 --- a/ci/docker/linux-apt-r.dockerfile +++ b/ci/docker/linux-apt-r.dockerfile @@ -93,6 +93,7 @@ RUN ln -s /usr/bin/python3 /usr/local/bin/python && \ COPY python/requirements-build.txt /arrow/python/ RUN pip install -r arrow/python/requirements-build.txt +ARG TZ="UTC" ENV \ ARROW_BUILD_STATIC=OFF \ ARROW_BUILD_TESTS=OFF \ @@ -108,4 +109,5 @@ ENV \ ARROW_S3=ON \ ARROW_USE_CCACHE=ON \ ARROW_USE_GLOG=OFF \ - LC_ALL=en_US.UTF-8 + LC_ALL=en_US.UTF-8 \ + TZ=${TZ} diff --git a/ci/docker/linux-r.dockerfile b/ci/docker/linux-r.dockerfile index ac414829d42..6e71f9168ab 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}" From d21c82de7c1c1ffd47f1d0844e60b1377bdc7282 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Mon, 12 Jul 2021 13:14:55 -0500 Subject: [PATCH 4/9] move the TZ setting up above installing the dependencies --- ci/docker/linux-apt-r.dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ci/docker/linux-apt-r.dockerfile b/ci/docker/linux-apt-r.dockerfile index a528ee11c7a..bc4df5af842 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 @@ -93,7 +96,6 @@ RUN ln -s /usr/bin/python3 /usr/local/bin/python && \ COPY python/requirements-build.txt /arrow/python/ RUN pip install -r arrow/python/requirements-build.txt -ARG TZ="UTC" ENV \ ARROW_BUILD_STATIC=OFF \ ARROW_BUILD_TESTS=OFF \ @@ -109,5 +111,4 @@ ENV \ ARROW_S3=ON \ ARROW_USE_CCACHE=ON \ ARROW_USE_GLOG=OFF \ - LC_ALL=en_US.UTF-8 \ - TZ=${TZ} + LC_ALL=en_US.UTF-8 From b0d0c8e18b0ec00759f322940e35788102edaf9e Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Tue, 13 Jul 2021 10:02:19 -0500 Subject: [PATCH 5/9] Use French Polynesian TZ for improbable TZ testing --- .github/workflows/r.yml | 4 +++- r/tests/testthat/test-Array.R | 4 ++-- r/tests/testthat/test-data-type.R | 2 +- r/tests/testthat/test-python.R | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index e1647807cef..b35da66b65a 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() 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-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) From f2e776d4db1860fac303526115815e3f8d956406 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Tue, 13 Jul 2021 10:39:13 -0500 Subject: [PATCH 6/9] rebase + one more change --- r/tests/testthat/test-dplyr-lubridate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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( From d312ab0cdac0691b709a0a0b8d6f821a2740e1fb Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Tue, 13 Jul 2021 10:50:49 -0500 Subject: [PATCH 7/9] unset TZ in some GHA builds --- .github/workflows/r.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index b35da66b65a..f6d207a9429 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -149,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() From 11082fe1f1b740eb74c825c26ec58c62fe34377b Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Tue, 13 Jul 2021 10:55:33 -0500 Subject: [PATCH 8/9] Update .github/workflows/r.yml Co-authored-by: Rok Mihevc --- .github/workflows/r.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index f6d207a9429..d7e3b67bc4b 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -89,7 +89,7 @@ jobs: run: | sudo sysctl -w kernel.core_pattern="core.%e.%p" ulimit -c unlimited - # Setting a non-default and non-probable MArquesas French Polynesia time + # 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 From 20ba50f286ba815b8afe9861c3cb0d39b6d99ec8 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Tue, 13 Jul 2021 13:24:51 -0500 Subject: [PATCH 9/9] actually parameterize the TZ variable for both build and runtime --- .env | 1 + ci/docker/linux-apt-r.dockerfile | 4 ++-- ci/docker/linux-r.dockerfile | 4 ++-- docker-compose.yml | 5 +++++ 4 files changed, 10 insertions(+), 4 deletions(-) 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/ci/docker/linux-apt-r.dockerfile b/ci/docker/linux-apt-r.dockerfile index bc4df5af842..97029ce62ad 100644 --- a/ci/docker/linux-apt-r.dockerfile +++ b/ci/docker/linux-apt-r.dockerfile @@ -19,8 +19,8 @@ ARG base FROM ${base} ARG arch -ARG TZ="UTC" -ENV TZ=${TZ} +ARG tz="UTC" +ENV TZ=${tz} # Build R # [1] https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04 diff --git a/ci/docker/linux-r.dockerfile b/ci/docker/linux-r.dockerfile index 6e71f9168ab..a501d69955c 100644 --- a/ci/docker/linux-r.dockerfile +++ b/ci/docker/linux-r.dockerfile @@ -30,8 +30,8 @@ ENV ARROW_R_DEV=${r_dev} ARG devtoolset_version=-1 ENV DEVTOOLSET_VERSION=${devtoolset_version} -ARG TZ="UTC" -ENV TZ=${TZ} +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"