Add from_apache_arrow / from_polars bridges and try_* fallible siblings#70
Merged
Conversation
ab78f62 to
2869611
Compare
Adds symmetric from_* import API across Array, FieldArray, Table,
SuperArray, and SuperTable. Each panicking method has a try_* sibling
returning Result<_, MinarrowError>. Adds From<&Series>, From<&RecordBatch>,
From<&DataFrame>, From<&[RecordBatch]> for .into() ergonomics.
Bridge logic between Minarrow's C Data Interface and arrow-rs / polars
is now centralised in two new feature-gated modules:
- src/ffi/arrow_rs.rs (cast_arrow)
- src/ffi/polars.rs (cast_polars)
Each exposes an export / import pair built on the existing
arrow_c_ffi::export_to_c and import_from_c_owned primitives.
New MinarrowError::BridgeError variant carries arrow-rs / polars FFI
failures, with feature-gated From impls for ArrowError and PolarsError.
Breaking changes:
- Removes Array::to_apache_arrow_with_field and
Array::to_polars_with_field. Wrap in FieldArray and call its to_*()
method when an explicit Field is needed.
- Renames SuperArray::to_apache_arrow_chunks and
SuperTable::to_apache_arrow_batches to to_apache_arrow for symmetry
across the bridge API. Return types disambiguate the shape.
Also fixes a per-call Box leak in the existing to_* paths where the
ArrowArray/ArrowSchema heap wrappers were not freed after read().
2869611 to
133669e
Compare
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.
Mirrors the existing to_* API across Array, FieldArray, Table, SuperArray,
and SuperTable. Each panicking method has a try_* sibling returning
Result<_, MinarrowError>. Adds From<&Series>, From<&RecordBatch>,
From<&DataFrame> for .into() ergonomics.
New MinarrowError::BridgeError variant carries arrow-rs / polars FFI
failures, with feature-gated From impls for ArrowError and PolarsError.
Breaking changes:
- Removes Array::to_apache_arrow_with_field and Array::to_polars_with_field. Wrap in FieldArray and call its to_*() method when an explicit Field is needed.
- Renames SuperArray::to_apache_arrow_chunks and SuperTable::to_apache_arrow_batches to to_apache_arrow for symmetry across the bridge API. Return types disambiguate the shape.
Also fixes a per-call Box leak in the existing to_* paths where the
ArrowArray/ArrowSchema heap wrappers were not freed after read().
Closes #65