feat: allow custom error codes on exported FFI_ArrowArrayStream#10300
Closed
fornwall wants to merge 1 commit into
Closed
feat: allow custom error codes on exported FFI_ArrowArrayStream#10300fornwall wants to merge 1 commit into
FFI_ArrowArrayStream#10300fornwall wants to merge 1 commit into
Conversation
FFI_ArrowArrayStream::new maps every stream error to one of ENOSYS/ENOMEM/EIO/EINVAL based solely on the ArrowError variant. Producers whose errors carry richer semantics than the variant can express have no way to surface them: an ADBC driver wrapping its error in ArrowError::ExternalError always lands in the EINVAL catch-all, even though the ADBC specification expects ECANCELED from get_next after a cancelled query. Such producers currently have to vendor the entire unsafe export scaffolding just to change one function. Add FFI_ArrowArrayStream::new_with_error_code, which takes the error-code mapping as a closure; new keeps the existing variant-based mapping as its default. A mapping that returns 0 for an error is coerced to EINVAL, since 0 would signal success and lead the consumer to read the uninitialized out-parameter. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DZxDaarQAUqUh9rQq3UmSz
FFI_ArrowArrayStream
Author
|
This doesn't seem that useful/necessary, at least for the ADBC use case - see apache/arrow-adbc#4475. |
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.
Disclaimer: Most of this PR description and code was AI generated. I have reviewed the code and think it makes sense. Let me know if I should dig into any detail or do modifications.
FFI_ArrowArrayStream::newmaps every stream error to one ofENOSYS/ENOMEM/EIO/EINVALbased solely on theArrowErrorvariant.Producers whose errors carry richer semantics than the variant can express have no way to surface them: an
ADBCdriver wrapping its error inArrowError::ExternalErroralways lands in theEINVALcatch-all, even though the ADBC specification expectsECANCELEDfromget_nextafter a cancelled query. Such producers currently have to vendor the entire unsafe export scaffolding just to change one function.Add
FFI_ArrowArrayStream::new_with_error_code, which takes the error-code mapping as a closure;newkeeps the existing variant-based mapping as its default. A mapping that returns0for an error is coerced toEINVAL, since0would signal success and lead the consumer to read the uninitialized out-parameter.