Skip to content

Commit 668ce8c

Browse files
Update datafusion/functions-aggregate/src/array_agg.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4be977f commit 668ce8c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

datafusion/functions-aggregate/src/array_agg.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,19 @@ impl AggregateUDFImpl for ArrayAgg {
112112
}
113113

114114
fn return_field(&self, arg_fields: &[FieldRef]) -> Result<FieldRef> {
115-
// Preserve the nullability of the input field in the list field
116-
// If the input is non-nullable, the list itself is non-nullable
117-
// If the input is nullable, the list is nullable
115+
// Preserve the nullability of the input field in the aggregate result field
116+
// If the input is non-nullable, the aggregate result field is non-nullable
117+
// If the input is nullable, the aggregate result field is nullable
118118
let input_field = &arg_fields[0];
119119
let list_field = Field::new_list_field(
120120
input_field.data_type().clone(),
121-
true, // elements in the list can be null
121+
true, // elements in the list (array elements) can be null
122122
);
123123

124124
Ok(Arc::new(Field::new(
125125
self.name(),
126126
DataType::List(Arc::new(list_field)),
127-
input_field.is_nullable(), // preserve input field's nullability
127+
input_field.is_nullable(), // preserve input field's nullability in the aggregate result field
128128
)))
129129
}
130130

0 commit comments

Comments
 (0)