You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/01/24 18:03:11 UTC
[GitHub] [arrow] jonkeane commented on a change in pull request #12240: ARROW-14442 [R]behaviour when converting timestamps with "" as tzone
jonkeane commented on a change in pull request #12240:
URL: https://github.com/apache/arrow/pull/12240#discussion_r791019809
##########
File path: r/tests/testthat/test-Array.R
##########
@@ -985,3 +985,14 @@ test_that("Array to C-interface", {
delete_arrow_schema(schema_ptr)
delete_arrow_array(array_ptr)
})
+
+test_that("Array coverts timestamps with missing timezone /assumed local tz correctly", {
+ withr::with_envvar(c(TZ = "America/Chicago"), {
Review comment:
We want this to actually be unset though, right? Similar to https://github.com/apache/arrow/blob/daa5c18e9697a6455a7a75fec19594543c17b21e/r/tests/testthat/test-Array.R#L264-L267 to simulate the circumstance where TZ is unset (though we might want to use `TZ = NA` instead of `TZ = ""` there since `NA` _unsets_ the variable instead of simply setting it to `""`)
``` r
Sys.getenv("TZ")
#> [1] ""
timestamp_r <- as.POSIXct("2018-10-07 19:04:05")
timestamp_r
#> [1] "2018-10-07 19:04:05 CDT"
attributes(timestamp_r)
#> $class
#> [1] "POSIXct" "POSIXt"
#>
#> $tzone
#> [1] ""
as.integer(timestamp_r)
#> [1] 1538957045
Sys.setenv("TZ" = "Australia/Brisbane")
timestamp_r <- as.POSIXct("2018-10-07 19:04:05")
timestamp_r
#> [1] "2018-10-07 19:04:05 AEST"
attributes(timestamp_r)
#> $class
#> [1] "POSIXct" "POSIXt"
#>
#> $tzone
#> [1] ""
as.integer(timestamp_r)
#> [1] 1538903045
Sys.unsetenv("TZ")
timestamp_r <- as.POSIXct("2018-10-07 19:04:05")
timestamp_r
#> [1] "2018-10-07 19:04:05 CDT"
attributes(timestamp_r)
#> $class
#> [1] "POSIXct" "POSIXt"
#>
#> $tzone
#> [1] ""
as.integer(timestamp_r)
#> [1] 1538957045
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org