Repository navigation
GH-55605: [R] Don't abort when comparing R extension types off the R thread - #55621
Closed
csarushan1729 wants to merge 1 commit into
Closed
csarushan1729 wants to merge 1 commit into
csarushan1729 wants to merge 1 commit into
Conversation
|
|
|
|
Member
|
I'm not entirely convinced by the answers to the "Was AI used for this PR?" section here |
|
|
Author
|
@thisisnic Thanks for flagging this, and sorry that I missed putting it correctly. Now, I’ve updated the description. Happy to make any changes. |
Member
|
Mind updating the PR description to be in your own words instead of AI generated? That would help with the review. Thanks! |
|
|
Author
|
sure, I’ve rewritten the description (in my own words) 👍 |
Author
|
Thanks for taking a look. I had updated the description in my own words as
you asked. Could you let me know why it was closed, so I can do better on
future PRs? Happy to make changes if it can be reopened.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
Arrow sometimes needs to check if two extension types are the same. If the name and settings already match, done. If not, it asks R to decide. But when a dataset is being scanned on a background thread, R can't be asked from there. The code threw an error, nobody was there to catch it, and the whole R session got killed.
You can hit this by reading a dataset where two files use the same extension type but with different settings, using
collect()orScanner$create(ds)$ToTable().What changes are included in this PR?
Now, if R can't be asked, the check just says "not equal" and moves on. That's what R's own default check would say anyway, because the settings are different. So instead of a crash, the scan stops with the usual "can't cast between extension types" error you already get on a single thread.
A few things stay the same:
RunWithCapturedR(), R is still called, and if it errors, that error comes through like before.One limitation: on a background thread, if someone wrote their own
ExtensionEquals()in a subclass, it won't get a chance to run. Two types with different settings will just count as different. Earlier this case crashed, so it's still better than before.Are these changes tested?
Yes. In
test-extension.RI added a test that writes two files with the same extension type but different settings. It checks that bothcollect()andScanner$create(ds)$ToTable()give an R error. Before the fix, this test killed R (exit status 134).I ran the full
test-extension.Rand everything passed (52 tests, no failures). I also rantest-dataset.Randtest-safe-call-into-r.R, and they behave the same with and without the change.Are there any user-facing changes?
Yes. Reading a dataset like this now gives a normal R error, and your R session stays open.
This PR contains a "Critical Fix". It stops a crash that happens with normal, documented use.
Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Reviewed before submission by: