You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 3. tags map contains non-null string values only
1984
+
1985
+
// Note about nullable values inside the tags map:
1986
+
// The tags field type is Option<HashMap<String, Option<String>>>, which means:
1987
+
// - The outer Option makes the entire field nullable (field can be absent or null)
1988
+
// - The inner Option<String> makes individual map values nullable (value can be null)
1989
+
// This preserves null values in the map, unlike #[allow_null_container_values]
1990
+
// which would drop them during materialization.
1991
+
1992
+
// Case 1: tags field is null
1993
+
let json1 = r#"{"path":"file1.parquet","partitionValues":{},"size":100,"modificationTime":1234567890,"dataChange":true,"tags":null}"#;
1994
+
let add1:Add = serde_json::from_str(json1).unwrap();
1995
+
assert_eq!(add1.tags,None);
1996
+
1997
+
// Case 2: tags map contains nullable values (some keys map to null)
1998
+
let json2 = r#"{"path":"file2.parquet","partitionValues":{},"size":200,"modificationTime":1234567890,"dataChange":true,"tags":{"INSERTION_TIME":"1677811178336000","NULLABLE_TAG":null}}"#;
1999
+
let add2:Add = serde_json::from_str(json2).unwrap();
2000
+
assert!(add2.tags.is_some());
2001
+
let tags = add2.tags.unwrap();
2002
+
assert_eq!(tags.len(),2);
2003
+
assert_eq!(
2004
+
tags.get("INSERTION_TIME"),
2005
+
Some(&Some("1677811178336000".to_string()))
2006
+
);
2007
+
assert_eq!(tags.get("NULLABLE_TAG"),Some(&None));
2008
+
2009
+
// Case 3: tags map contains non-null string values only
2010
+
let json3 = r#"{"path":"file3.parquet","partitionValues":{},"size":300,"modificationTime":1234567890,"dataChange":true,"tags":{"INSERTION_TIME":"1677811178336000","MIN_INSERTION_TIME":"1677811178336000"}}"#;
2011
+
let add3:Add = serde_json::from_str(json3).unwrap();
0 commit comments