GH-48832: [R] Fix crash with zero-length POSIXct tzone attribute#49619
GH-48832: [R] Fix crash with zero-length POSIXct tzone attribute#49619thisisnic merged 3 commits intoapache:mainfrom
Conversation
|
FYI, I used Claude to generate this PR. I am not super familiar with the |
| } else if (Rf_inherits(x, "POSIXct")) { | ||
| return POSIXCT; |
There was a problem hiding this comment.
Oh, huh I wonder if this type is new? Or maybe I "just" forgot about it when I made these changes?
There was a problem hiding this comment.
🤖 says that it's not new, but historically, POSIXct was always REALSXP (backed by a double) until R 4.5.2, but now for zero-length POSIXct objects that's no longer the case, so it needs checking in the INTSXP path.
Or, with more detail:
So in R 4.5.0, R changed as.POSIXct({}) (i.e., zero-length POSIXct) to be internally stored as integer (INTSXP) rather than double (REALSXP). This is a deliberate change for consistency - zero-length date-time objects don't need the full double precision since they have no actual values to store.
|
@github-actions crossbow submit test-r-versions |
|
Revision: 8e29ee5 Submitted crossbow builds: ursacomputing/crossbow @ actions-c0634dd2bf
|
Failures look unrelated; I need to update some bucket settings. Probably worth getting that done and retriggering CI here though to make sure this isn't a new thing in 4.5.2. |
Thanks for this! I was going to make an issue when I triggered these but then got distracted. It sounds like you know what's up there — I could guess but I haven't dug too much into it |
jonkeane
left a comment
There was a problem hiding this comment.
Oops, forgot to actually approve this.
|
@github-actions crossbow submit test-r-versions |
|
Revision: 8e29ee5 Submitted crossbow builds: ursacomputing/crossbow @ actions-8e361a7bbb
|
8e29ee5 to
e1f0d16
Compare
|
Needs rebasing...will try again |
|
@github-actions crossbow submit test-r-versions |
|
Revision: e1f0d16 Submitted crossbow builds: ursacomputing/crossbow @ actions-a2f34c245b
|
|
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit d035788. There were 4 benchmark results with an error:
There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them. |
Rationale for this change
In R 4.5.2+,
as.POSIXct(x = NULL)creates a zero-lengthPOSIXctwithINTSXP(integer) type, notREALSXP(double). TheGetVectorType()function inr_to_arrow.cpponly checked forPOSIXctin theREALSXPbranch, so it misclassified zero-lengthPOSIXctasINT32.What changes are included in this PR?
Map any
POSIXctobject to correct class by adding the check to theINTSXPbranch ofGetVectorType()Are these changes tested?
Yes
Are there any user-facing changes?
No