kosiew commented on code in PR #24029:
URL: https://github.com/apache/datafusion/pull/24029#discussion_r3713228519
##########
datafusion/common/src/scalar/mod.rs:
##########
@@ -11544,4 +11547,28 @@ mod tests {
run_tests::<Decimal128Type>();
run_tests::<Decimal256Type>();
}
+
+ #[test]
+ fn test_new_list_nested_nullability_mismatch_issue_24022() {
+ // requested element type: Struct(n: Int32 nullable=true)
+ let requested_element_type =
+ DataType::Struct(Fields::from(vec![Field::new("n",
DataType::Int32, true)]));
+
+ // inferred from concrete values: Struct(n: Int32 nullable=false)
+ let inferred_field = Field::new("n", DataType::Int32, false);
+
+ let value = ScalarValue::Struct(Arc::new(StructArray::from(vec![(
+ Arc::new(inferred_field),
+ Arc::new(Int32Array::from(vec![1])) as ArrayRef,
+ )])));
+
+ let list = ScalarValue::new_list(&[value], &requested_element_type,
true);
Review Comment:
Could we extend this regression to cover all three constructors changed by
this PR?
Right now it only calls `new_list` and checks `list.data_type()`. A shared
assertion for `new_list`, `new_list_from_iter`, and `new_large_list` would also
let us verify both the declared nested child type and the normalized child
values.
This is a suggestion only.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]