Skip to content

Commit f406fc2

Browse files
committed
array_distinct ensure return type match result's nullability
1 parent 0d1b46a commit f406fc2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

datafusion/functions-nested/src/set_ops.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,14 @@ impl ScalarUDFImpl for ArrayDistinct {
290290

291291
fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
292292
match &arg_types[0] {
293-
List(field) => Ok(DataType::new_list(field.data_type().clone(), true)),
294-
LargeList(field) => {
295-
Ok(DataType::new_large_list(field.data_type().clone(), true))
296-
}
293+
List(field) => Ok(DataType::new_list(
294+
field.data_type().clone(),
295+
field.is_nullable(),
296+
)),
297+
LargeList(field) => Ok(DataType::new_large_list(
298+
field.data_type().clone(),
299+
field.is_nullable(),
300+
)),
297301
arg_type => plan_err!("{} does not support type {arg_type}", self.name()),
298302
}
299303
}

0 commit comments

Comments
 (0)