alamb commented on code in PR #15551:
URL: https://github.com/apache/datafusion/pull/15551#discussion_r2036175257


##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -987,6 +988,25 @@ fn coerce_fields(common_type: DataType, lhs: &FieldRef, 
rhs: &FieldRef) -> Field
     Arc::new(Field::new(name, common_type, is_nullable))
 }
 
+/// coerce two types if they are Maps by coercing their inner 'entries' 
fields' types
+/// using struct coercion
+fn map_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataType> {
+    use arrow::datatypes::DataType::*;
+    match (lhs_type, rhs_type) {
+        (Map(lhs_field, lhs_ordered), Map(rhs_field, rhs_ordered)) => {
+            struct_coercion(lhs_field.data_type(), rhs_field.data_type()).map(
+                |key_value_type| {
+                    Map(
+                        
Arc::new((**lhs_field).clone().with_data_type(key_value_type)),

Review Comment:
   I think you can use `as_ref()` here is you prefer less `**`
   
   ```suggestion
                           
Arc::new(lhs_field.as_ref().clone().with_data_type(key_value_type)),
   ```



-- 
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

Reply via email to