Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-14442: [R] fix behaviour when converting timestamps with "" as tzone #12240

Closed
wants to merge 56 commits into from

Conversation

dragosmg
Copy link
Contributor

No description provided.

@github-actions
Copy link

@github-actions
Copy link

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

r/R/array.R Outdated Show resolved Hide resolved
@dragosmg
Copy link
Contributor Author

I think this is almost ready to go. 2 questions remain in my mind:

  1. do we want to do anything special for the cases when, for some reason, Sys.timezone() returns NA or an empty string?
  2. do we want to inform the user about the change in timezone - from timezoneless to system time zone?

Copy link
Member

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

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

Thanks for all the digging on this. I have a few comments about adding a few more tests.

I also wonder if we should actually be making this change at

auto tzone_sexp = Rf_getAttrib(x, symbols::tzone);
if (Rf_isNull(tzone_sexp)) {
return timestamp(TimeUnit::MICRO);
} else {
return timestamp(TimeUnit::MICRO, CHAR(STRING_ELT(tzone_sexp, 0)));

which already handles some of the timezone conversion, instead of inside of Array$create(). Doing it in type_infer would mean anything that uses that code would benefit and not just be limited to Array creation

r/tests/testthat/test-Array.R Outdated Show resolved Hide resolved
@jonkeane
Copy link
Member

Any thoughts about what I suggested in #12240 (review) ?

@dragosmg
Copy link
Contributor Author

dragosmg commented Jan 26, 2022

I think it would make a lot of sense to make the change at a lower level. In fact, that was a question I had on my list but never asked. I will look into the cpp code to see if I can figure out how to make the change there. Thanks

@jonkeane jonkeane changed the title ARROW-14442 [R]behaviour when converting timestamps with "" as tzone ARROW-14442: [R] behaviour when converting timestamps with "" as tzone Jan 28, 2022
@jonkeane jonkeane changed the title ARROW-14442: [R] behaviour when converting timestamps with "" as tzone ARROW-14442: [R] fix behaviour when converting timestamps with "" as tzone Jan 28, 2022
r/src/type_infer.cpp Outdated Show resolved Hide resolved
@dragosmg
Copy link
Contributor Author

dragosmg commented Feb 1, 2022

It seems some unit tests are failing on Windows due to the timezone database not being found.

@jonkeane
Copy link
Member

jonkeane commented Feb 1, 2022

I'm not totally surprised that windows + timezones has popped up here. Can you tell the nature of the problem?

# test_date + 1 turns the tzone = "" to NULL, which is functionally equivalent
# so we can run some tests on Windows, but this skirts around
# https://issues.apache.org/jira/browse/ARROW-13588
# That issue is tough because in C++, "" is the "no timezone" value
# due to static typing, so we can't distinguish a literal "" from NULL

might be relevant here

@dragosmg
Copy link
Contributor Author

dragosmg commented Feb 2, 2022

@jonkeane could the solution be to simply skip the failing tests on Windows?

@jonkeane
Copy link
Member

jonkeane commented Feb 3, 2022

@jonkeane could the solution be to simply skip the failing tests on Windows?

We've done that for others like this. I would recommend going through the errors and confirming that they stem from https://issues.apache.org/jira/browse/ARROW-13168 and mark that as the reason for skipping on windows. Some of the error output in CI looks like it is, but others looked slightly different (they might have the same root cause still, but when I looked through the logs I was not 100% confident they were all ARROW-13168)

@dragosmg
Copy link
Contributor Author

Currently blocked by ARROW-13168.

dragosmg added a commit to dragosmg/arrow that referenced this pull request Mar 4, 2022
dragosmg added a commit to dragosmg/arrow that referenced this pull request Mar 4, 2022
@dragosmg dragosmg marked this pull request as ready for review March 30, 2022 14:03
@dragosmg
Copy link
Contributor Author

@jonkeane I revived this PR. It looks like (most of) the Windows tzdb issues have magically gone away.

@rok
Copy link
Member

rok commented Mar 30, 2022

Yup, here's the magic: #12536

@dragosmg
Copy link
Contributor Author

Yep, I know. I was waiting for that PR to get merged. 😉

Copy link
Member

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

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

Woo, I like simple changes like this that just work in the end 😄

A few questions | comments

r/tests/testthat/helper-skip.R Outdated Show resolved Hide resolved
r/tests/testthat/test-Array.R Outdated Show resolved Hide resolved
r/tests/testthat/test-Array.R Outdated Show resolved Hide resolved
@dragosmg dragosmg requested a review from jonkeane March 31, 2022 09:08
Copy link
Member

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

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

This is great, a few suggestions + one request for one more test (or point to where it exists elsewhere...)

r/tests/testthat/test-Array.R Show resolved Hide resolved
r/tests/testthat/test-Array.R Show resolved Hide resolved
r/tests/testthat/test-Array.R Show resolved Hide resolved
r/R/arrow-package.R Outdated Show resolved Hide resolved
@AlenkaF
Copy link
Member

AlenkaF commented Apr 5, 2022

Looks good to me 👍

@jonkeane jonkeane closed this in 633687c Apr 11, 2022
@ursabot
Copy link

ursabot commented Apr 11, 2022

Benchmark runs are scheduled for baseline = e453ffe and contender = 633687c. 633687c is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️1.0% ⬆️0.25%] test-mac-arm
[Failed ⬇️0.0% ⬆️0.36%] ursa-i9-9960x
[Finished ⬇️0.17% ⬆️0.04%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/484| 633687c1 ec2-t3-xlarge-us-east-2>
[Failed] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/469| 633687c1 test-mac-arm>
[Failed] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/470| 633687c1 ursa-i9-9960x>
[Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/479| 633687c1 ursa-thinkcentre-m75q>
[Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/483| e453ffef ec2-t3-xlarge-us-east-2>
[Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/468| e453ffef test-mac-arm>
[Failed] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/469| e453ffef ursa-i9-9960x>
[Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/478| e453ffef ursa-thinkcentre-m75q>
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@dragosmg dragosmg deleted the timestampts_missing_timezone branch April 12, 2022 12:44
jcralmeida pushed a commit to rafael-telles/arrow that referenced this pull request Apr 19, 2022
…tzone

Closes apache#12240 from dragosmg/timestampts_missing_timezone

Authored-by: Dragoș Moldovan-Grünfeld <[email protected]>
Signed-off-by: Jonathan Keane <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants