alamb commented on code in PR #14401: URL: https://github.com/apache/datafusion/pull/14401#discussion_r1939297553
########## datafusion/functions-nested/src/map_keys.rs: ########## @@ -126,9 +126,36 @@ fn map_keys_inner(args: &[ArrayRef]) -> Result<ArrayRef> { }; Ok(Arc::new(ListArray::new( - Arc::new(Field::new_list_field(map_array.key_type().clone(), false)), + Arc::new(Field::new_list_field(map_array.key_type().clone(), true)), map_array.offsets().clone(), Arc::clone(map_array.keys()), - None, + map_array.nulls().cloned(), ))) } + +#[cfg(test)] +mod test { Review Comment: I think you can test it using slt with this trick (create a column with non null value and then insert a `NULL` into it) ```sql DataFusion CLI v44.0.0 > create table foo as values (MAP {'foo': 'bar'}); 0 row(s) fetched. Elapsed 0.037 seconds. > insert into foo values (NULL); +-------+ | count | +-------+ | 1 | +-------+ 1 row(s) fetched. Elapsed 0.016 seconds. > select * from foo; +------------+ | column1 | +------------+ | {foo: bar} | | NULL | +------------+ 2 row(s) fetched. Elapsed 0.004 seconds. > select column1, arrow_typeof(column1) from foo; +------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | column1 | arrow_typeof(foo.column1) | +------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | {foo: bar} | Map(Field { name: "entries", data_type: Struct([Field { name: "key", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "value", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false) | | NULL | Map(Field { name: "entries", data_type: Struct([Field { name: "key", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "value", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false) | +------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 2 row(s) fetched. Elapsed 0.006 seconds. ``` -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org