XiaoHongbo-Hope commented on code in PR #205:
URL: https://github.com/apache/paimon-rust/pull/205#discussion_r3036386431


##########
crates/paimon/src/spec/stats.rs:
##########
@@ -15,9 +15,32 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use serde::{Deserialize, Serialize};
+use serde::{Deserialize, Deserializer, Serialize, Serializer};
 use std::fmt::{Display, Formatter};
 
+/// Deserialize `_NULL_COUNTS` which in Avro is `["null", 
{"type":"array","items":["null","long"]}]`.
+/// Flattens nullable array with nullable items into `Vec<i64>`, treating null 
items as 0.
+fn deserialize_null_counts<'de, D>(deserializer: D) -> Result<Vec<i64>, 
D::Error>
+where
+    D: Deserializer<'de>,
+{
+    let opt: Option<Vec<Option<i64>>> = Option::deserialize(deserializer)?;
+    Ok(opt
+        .unwrap_or_default()
+        .into_iter()
+        .map(|v| v.unwrap_or(0))

Review Comment:
   Seems this will make null item in null_counts as 0, which is different 
actually.  Null should mean "unknown",  and 0 means 'this is no null value'.



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

Reply via email to