goldmedal commented on code in PR #11452:
URL: https://github.com/apache/datafusion/pull/11452#discussion_r1676853439


##########
datafusion/sqllogictest/test_files/map.slt:
##########
@@ -131,17 +131,23 @@ SELECT MAKE_MAP([1,2], ['a', 'b'], [3,4], ['b']);
 ----
 {[1, 2]: [a, b], [3, 4]: [b]}
 
-query error
+query ?
 SELECT MAKE_MAP('POST', 41, 'HEAD', 'ab', 'PATCH', 30);
+----
+{POST: 41, HEAD: ab, PATCH: 30}

Review Comment:
   I expected the query would fail because similar behavior isn't allowed in 
other databases (e.g. DuckDB). However, seems `make_array` will coercion the 
value to find a suitable type for them. In this case, all of them will be 
converted to `utf8`.
   ```
   
   > select make_array(1,'a',3);
   +-----------------------------------------+
   | make_array(Int64(1),Utf8("a"),Int64(3)) |
   +-----------------------------------------+
   | [1, a, 3]                               |
   +-----------------------------------------+
   1 row(s) fetched. 
   Elapsed 0.004 seconds.
   
   > select arrow_typeof(make_array(1,'a',3));
   
+-----------------------------------------------------------------------------------------------------------------+
   | arrow_typeof(make_array(Int64(1),Utf8("a"),Int64(3)))                      
                                     |
   
+-----------------------------------------------------------------------------------------------------------------+
   | List(Field { name: "item", data_type: Utf8, nullable: true, dict_id: 0, 
dict_is_ordered: false, metadata: {} }) |
   
+-----------------------------------------------------------------------------------------------------------------+
   1 row(s) fetched. 
   Elapsed 0.002 seconds.
   ```
   I think if DataFusion allows this type of coercion for `make_array`, we can 
allow it for `make_map` too.



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