findepi opened a new issue, #14552:
URL: https://github.com/apache/datafusion/issues/14552

   Accessing a map with a non-string key doesn't work (at least via DataFusion 
SQL) and is covered by https://github.com/apache/datafusion/issues/11785
   
   Accessing a map with a literal string key works:
   
   
https://github.com/apache/datafusion/blob/5e1e693b6e30888d710aefc57be58ea25f62d34d/datafusion/sqllogictest/test_files/map.slt#L69-L72
   
   Add support for accessing a map with non-literal key. 
   For example this should work:
   
   ```
   query ok
   SELECT SUM(ints['by' || 'tes']) FROM data;
   ```
   
   but it does not:
   > `DataFusion error: Error during planning: Failed to coerce arguments to 
satisfy a call to 'array_element' function: coercion from [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: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, 
metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, 
metadata: {} }, false), Utf8] to the signature 
ArraySignature(ArrayAndIndexes(1)) failed No function matches the given name 
and argument types 'array_element(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: 
Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }]), 
nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false), 
Utf8)'. You might need to add explicit t
 ype casts.
        Candidate functions:
        array_element(array, index`


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