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

[GitHub] [arrow-rs] jackwener opened a new pull request, #4387: field just display dict_id, dict_is_ordered for Dictionary

jackwener opened a new pull request, #4387:
URL: https://github.com/apache/arrow-rs/pull/4387

   # Which issue does this PR close?
   
   Closes #.
   
   # Rationale for this change
    
   
   
   # What changes are included in this PR?
   
   Field just display dict_id, dict_is_ordered for Dictionary
   Make field format clear
   
   # Are there any user-facing changes?
   
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking change` label.
   -->
   


-- 
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


[GitHub] [arrow-rs] jackwener closed pull request #4387: field don't show dict_id, dict_is_ordered in `format/debug`

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener closed pull request #4387: field don't show dict_id, dict_is_ordered in `format/debug`
URL: https://github.com/apache/arrow-rs/pull/4387


-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4387: field don't show dict_id, dict_is_ordered in `format/debug`

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4387:
URL: https://github.com/apache/arrow-rs/pull/4387#discussion_r1223321788


##########
arrow-schema/src/field.rs:
##########
@@ -543,10 +543,23 @@ 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 {
+        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:?}")
+        write!(

Review Comment:
   I think this could just use the debug impl?



##########
arrow-schema/src/field.rs:
##########
@@ -543,10 +543,23 @@ 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 {
+        write!(

Review Comment:
   I think we should still print the dict id and ordered state if the datatype is a dictionary



-- 
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


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

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
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


[GitHub] [arrow-rs] jackwener commented on pull request #4387: field don't show dict_id, dict_is_ordered in `format/debug`

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on PR #4387:
URL: https://github.com/apache/arrow-rs/pull/4387#issuecomment-1586294024

   After careful consideration, I believe that this PR would result in many changes, but the benefits are not as substantial. Therefore, I have decided to close it.


-- 
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


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

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4387:
URL: https://github.com/apache/arrow-rs/pull/4387#discussion_r1222963328


##########
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:?}"),

Review Comment:
   As pointed out by clippy this will recurse infinitely



-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4387: field don't show dict_id, dict_is_ordered in `format/debug`

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4387:
URL: https://github.com/apache/arrow-rs/pull/4387#discussion_r1222963328


##########
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:?}"),

Review Comment:
   As pointed out by clippy this will recurse infinitely



-- 
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