Copilot commented on code in PR #16203:
URL: https://github.com/apache/datafusion/pull/16203#discussion_r2112167277
##########
datafusion/functions-nested/src/extract.rs:
##########
@@ -225,6 +225,23 @@ where
return Ok(Arc::new(NullArray::new(array.len())));
}
+ if let DataType::Struct(fields) = values.data_type() {
+ let has_null_fields = fields.iter().any(|field| field.data_type() ==
&Null);
+ if has_null_fields {
+ // Instead of trying to extract from malformed struct data and
return appropriate nulls
+ let mut null_array_data = Vec::with_capacity(array.len());
+ for _ in 0..array.len() {
+ null_array_data.push(None::<i32>);
+ }
+
Review Comment:
The variable 'null_array_data' is initialized and populated but never used,
which may lead to confusion. Consider removing this unused code to simplify the
function.
```suggestion
```
--
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]