You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/06/08 12:20:44 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4387: field just display dict_id, dict_is_ordered for Dictionary

tustvold commented on code in PR #4387:
URL: https://github.com/apache/arrow-rs/pull/4387#discussion_r1222962167


##########
arrow-schema/src/field.rs:
##########
@@ -543,10 +543,29 @@ impl Field {
     }
 }
 
-// TODO: improve display with crate https://crates.io/crates/derive_more ?
+impl std::fmt::Debug for Field {
+    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+        match &self.data_type {
+            DataType::Dictionary(_, _) => write!(f, "{self:?}"),
+            _ => write!(
+                f,
+                "Field {{ name: \"{}\", data_type: {:?}, nullable: {}, metadata: {:?} }}",
+                self.name, self.data_type, self.nullable, self.metadata
+            ),
+        }
+    }
+}
+
 impl std::fmt::Display for Field {
     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
-        write!(f, "{self:?}")
+        match &self.data_type {

Review Comment:
   Is this change necessary?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org