neilconway commented on code in PR #20805:
URL: https://github.com/apache/datafusion/pull/20805#discussion_r2942088736
##########
datafusion/functions-nested/src/map.rs:
##########
@@ -113,6 +184,27 @@ fn validate_map_keys(array: &dyn Array) -> Result<()> {
Ok(())
}
+/// Validates that map keys are non-null and unique.
+fn validate_map_keys(array: &dyn Array) -> Result<()> {
+ match array.data_type() {
+ DataType::Int8 => validate_unique_primitive_keys::<Int8Type>(array),
+ DataType::Int16 => validate_unique_primitive_keys::<Int16Type>(array),
+ DataType::Int32 => validate_unique_primitive_keys::<Int32Type>(array),
+ DataType::Int64 => validate_unique_primitive_keys::<Int64Type>(array),
+ DataType::UInt8 => validate_unique_primitive_keys::<UInt8Type>(array),
+ DataType::UInt16 =>
validate_unique_primitive_keys::<UInt16Type>(array),
+ DataType::UInt32 =>
validate_unique_primitive_keys::<UInt32Type>(array),
+ DataType::UInt64 =>
validate_unique_primitive_keys::<UInt64Type>(array),
+ DataType::Date32 =>
validate_unique_primitive_keys::<Date32Type>(array),
+ DataType::Date64 =>
validate_unique_primitive_keys::<Date64Type>(array),
+ DataType::Utf8 => validate_unique_string_keys::<i32>(array),
Review Comment:
Worth supporting Utf8View? And/or BinaryView?
##########
datafusion/functions-nested/src/map.rs:
##########
@@ -500,7 +500,8 @@ fn make_map_array_from_fixed_size_list(
let nulls_bitmap = keys.nulls().cloned();
let keys = fixed_size_list_to_arrays(keys);
- let values = fixed_size_list_to_arrays(values);
+ let values =
Review Comment:
Worth adding (or extending) a unit test for this behavior?
--
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]