Ruchirtripathi commented on code in PR #24029:
URL: https://github.com/apache/datafusion/pull/24029#discussion_r3748170964
##########
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:
Thanks for the great suggestion! @kosiew I've updated the test to fully
cover the invariant.
Here's a summary of the changes incorporated:
• Shared Assertion: I added a shared test block that comprehensively
verifies both the declared nested child type
and that the actual normalized child values are properly cast.
• Broader Coverage: The test now thoroughly exercises new_list,
new_list_from_iter, and new_large_list to ensure the
casting behavior holds across all three constructors.
• CI Fixes: I also resolved the minor struct layout sizes for the memory
accounting tests that were failing on the
Linux CI runners.
All tests and formatting checks are now green locally and on CI! Let me
know if everything looks good to go, and I'd
really appreciate it if you could merge this PR. Thanks again for your
review!**
--
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]