alamb commented on issue #5342:
URL: https://github.com/apache/arrow-rs/issues/5342#issuecomment-1975825386
If the goal is to allow @carols10cents to write this (which I agree would be
much more ergonomic):
```rust
fn schema_merge(batches: &[RecordBatch]) -> Result<Schema, ArrowError> {
Schema::try_merge(batches.iter().map(|b| b.schema()))
}
```
Perhaps we can change
[try_merge](https://docs.rs/arrow/latest/arrow/datatypes/struct.Schema.html#method.try_merge)
from
```rust
pub fn try_merge(
schemas: impl IntoIterator<Item = Schema>
) -> Result<Schema, ArrowError>
```
To take `SchemaRef`:
```rust
pub fn try_merge(
schemas: impl IntoIterator<Item = SchemaRef>
) -> Result<Schema, ArrowError>
```
Or alternately make a new function `Schema::try_merge_refs` or something
I realize this would incur extra runtime overhead of additional `Arc`
clones, but I think in the grand scheme of things it is pretty minimal compared
to logic that `Schema::try_merge` is doing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]