Skip to content

Commit 6a21b67

Browse files
authored
fix: align map_keys nullability flag (apache#17454)
* fix: align `map_keys` nullability flag
1 parent 7b65c5b commit 6a21b67

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

datafusion/functions-nested/src/map_keys.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ impl ScalarUDFImpl for MapKeysFunc {
9494
fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
9595
let [map_type] = take_function_args(self.name(), arg_types)?;
9696
let map_fields = get_map_entry_field(map_type)?;
97+
// internal array nullability is true to be in sync with DuckDB
9798
Ok(DataType::List(Arc::new(Field::new_list_field(
9899
map_fields.first().unwrap().data_type().clone(),
99-
false,
100+
true,
100101
))))
101102
}
102103

@@ -121,7 +122,8 @@ fn map_keys_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
121122
};
122123

123124
Ok(Arc::new(ListArray::new(
124-
Arc::new(Field::new_list_field(map_array.key_type().clone(), false)),
125+
// internal array nullability is true to be in sync with DuckDB
126+
Arc::new(Field::new_list_field(map_array.key_type().clone(), true)),
125127
map_array.offsets().clone(),
126128
Arc::clone(map_array.keys()),
127129
map_array.nulls().cloned(),

0 commit comments

Comments
 (0)