mkleen commented on PR #22730:
URL: https://github.com/apache/datafusion/pull/22730#issuecomment-4667844802

   Maps behave like Lists: 
   
   ```sql
   > select arrow_typeof(MAP {'key1': 2});
   
+---------------------------------------------------------------------------------+
   | arrow_typeof(map(make_array(Utf8("key1")),make_array(Int64(2))))           
     |
   
+---------------------------------------------------------------------------------+
   | Map("entries": non-null Struct("key": non-null Utf8, "value": Int64), 
unsorted) |
   
+---------------------------------------------------------------------------------+
   1 row(s) fetched. 
   
   
   > -- Change value type to non-null without any null value present works
   select arrow_cast(MAP {'key1': 1, 'key2': 2}, 'Map("entries": non-null 
Struct("key": non-null Utf8, "value": non-null Int64), unsorted)');
   
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | 
arrow_cast(map(make_array(Utf8("key1"),Utf8("key2")),make_array(Int64(1),Int64(2))),Utf8("Map("entries":
 non-null Struct("key": non-null Utf8, "value": non-null Int64), unsorted)")) |
   
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | {key1: 1, key2: 2}                                                         
                                                                                
                           |
   
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   1 row(s) fetched. 
   
   > -- Change value type to non-null with null value fails
   select arrow_cast(MAP {'key1': 1, 'key2': null}, 'Map("entries": non-null 
Struct("key": non-null Utf8, "value": non-null Int64), unsorted)');
   Optimizer rule 'simplify_expressions' failed
   caused by
   Arrow error: Invalid argument error: Found unmasked nulls for non-nullable 
StructArray field "value"
   ```


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

Reply via email to