friendlymatthew commented on code in PR #19355:
URL: https://github.com/apache/datafusion/pull/19355#discussion_r2679516432
##########
datafusion/datasource-avro/src/avro_to_arrow/schema.rs:
##########
@@ -118,7 +118,10 @@ fn schema_to_field_with_props(
.map(|s| schema_to_field_with_props(s, None, has_nullable,
None))
.collect::<Result<Vec<Field>>>()?;
let type_ids = 0_i8..fields.len() as i8;
- DataType::Union(UnionFields::new(type_ids, fields),
UnionMode::Dense)
+ DataType::Union(
+ UnionFields::try_new(type_ids, fields).unwrap(),
Review Comment:
Since the `type_ids` are autoincrementing, we can probably use
`UnionFields::from_fields(fields)` and avoid the `Result`
`UnionFields::from_fields` is a convenience constructor that will infallibly
construct the UnionFields (since the only check we really need is to ensure
type id uniqueness).
https://docs.rs/arrow/latest/arrow/datatypes/struct.UnionFields.html#method.from_fields
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]