This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 190b6ac0 fix(spec): implement Display for BinaryTableStats (#632)
190b6ac0 is described below
commit 190b6ac029653dc4a91618feffbeba1a0f624cb1
Author: kid <[email protected]>
AuthorDate: Mon Aug 3 11:44:04 2026 +0800
fix(spec): implement Display for BinaryTableStats (#632)
---
crates/paimon/src/spec/stats.rs | 36 ++++++++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/crates/paimon/src/spec/stats.rs b/crates/paimon/src/spec/stats.rs
index 7660366a..6e4017bc 100644
--- a/crates/paimon/src/spec/stats.rs
+++ b/crates/paimon/src/spec/stats.rs
@@ -137,8 +137,15 @@ impl BinaryTableStats {
}
impl Display for BinaryTableStats {
- fn fmt(&self, _: &mut Formatter<'_>) -> std::fmt::Result {
- todo!()
+ /// `min_values`/`max_values` are serialized `BinaryRow`s that cannot be
decoded without
+ /// the column types, so they print as raw bytes (same convention as
`DataFileMeta`'s
+ /// `minKey`/`keyStats` fields).
+ fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+ write!(
+ f,
+ "BinaryTableStats{{minValues={:?}, maxValues={:?},
nullCounts={:?}}}",
+ self.min_values, self.max_values, self.null_counts
+ )
}
}
@@ -236,4 +243,29 @@ mod tests {
let back =
BinaryTableStats::from_simple_stats_row_data(&bytes).unwrap();
assert_eq!(back.to_simple_stats_row_data(), bytes);
}
+
+ #[test]
+ fn display_formats_labeled_fields() {
+ let stats = BinaryTableStats::new(
+ vec![0, 0, 0, 2, 1],
+ vec![0, 0, 0, 2, 9],
+ vec![Some(0), None, Some(3)],
+ );
+ assert_eq!(
+ format!("{stats}"),
+ "BinaryTableStats{minValues=[0, 0, 0, 2, 1], maxValues=[0, 0, 0,
2, 9], \
+ nullCounts=[Some(0), None, Some(3)]}"
+ );
+ }
+
+ #[test]
+ fn display_empty_stats_does_not_panic() {
+ let stats = BinaryTableStats::empty();
+ let rendered = format!("{stats}");
+ assert!(
+ rendered.starts_with("BinaryTableStats{minValues=[")
+ && rendered.ends_with("nullCounts=[]}"),
+ "unexpected empty-stats rendering: {rendered}"
+ );
+ }
}