scovich commented on code in PR #8140:
URL: https://github.com/apache/arrow-rs/pull/8140#discussion_r2276945908


##########
parquet-variant/src/variant.rs:
##########
@@ -1286,6 +1286,77 @@ impl TryFrom<(i128, u8)> for Variant<'_, '_> {
     }
 }
 
+// helper to print <invalid> instead of "<invalid>" in debug mode when a 
VariantObject or VariantList contains invalid values.
+struct InvalidVariant;
+
+impl std::fmt::Debug for InvalidVariant {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        write!(f, "<invalid>")
+    }
+}
+
+// helper to print binary data in hex format in debug mode, as space-separated 
hex byte values.
+struct HexString<'a>(&'a [u8]);
+
+impl<'a> std::fmt::Debug for HexString<'a> {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        if let Some((first, rest)) = self.0.split_first() {

Review Comment:
   Most hex editors use this format, `01 02 03 04 de ad be ef` as more compact 
and readable than something comma-separated.
   
   I intentionally chose not to honor alt syntax for this one because IMO both 
of these look weird:
   ```
   Binary(
   ),
   Binary(
       01 02 03 04 de ad be ef,
   ),
   ```
   vs.
   ```
   Binary(),
   Binary(01 02 03 04 de ad be ef),
   ```
   
   (honestly, I wish the alt-printing for tuple types would always avoid line 
breaks when there's only a single value, but oh well)



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to