Weijun-H commented on code in PR #8529:
URL: https://github.com/apache/arrow-rs/pull/8529#discussion_r2399067220
##########
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:
After some investigation, I think we should continue using commas to
separate different fields, following the [DuckDB SQL
style](https://duckdb.org/docs/stable/sql/data_types/struct#creating-structs-with-the-row-function).
For metadata, since it is displayed with brackets, it should not be too
confusing.
--
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]