martin-g commented on code in PR #8529:
URL: https://github.com/apache/arrow-rs/pull/8529#discussion_r2398541404
##########
arrow-schema/src/datatype_display.rs:
##########
@@ -132,7 +132,24 @@ impl fmt::Display for DataType {
Ok(())
}
Self::Union(union_fields, union_mode) => {
- write!(f, "Union({union_fields:?}, {union_mode:?})")
+ write!(f, "Union({union_mode:?}, ")?;
+ if !union_fields.is_empty() {
+ let fields_str = union_fields
+ .iter()
+ .map(|v| {
+ let type_id = v.0;
+ let field = v.1;
+ let maybe_nullable = if field.is_nullable() {
"nullable " } else { "" };
+ let data_type = field.data_type();
+ let metadata_str =
format_metadata(field.metadata());
+ format!("{type_id:?}:
{maybe_nullable}{data_type}{metadata_str}")
+ })
+ .collect::<Vec<_>>()
+ .join(", ");
Review Comment:
Would it be better to use `;` as a separator ?
This way the `,` used to separate the metadata won't confuse the readers.
--
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]