goldmedal commented on PR #11361:
URL: https://github.com/apache/datafusion/pull/11361#issuecomment-2218411989

   I noticed the map and struct of Arrow allow duplicate keys but I think this 
behavior is wrong. 
   ```
   > select named_struct('abc', 1, 'abc', 2);
   +---------------------------------------------------------+
   | named_struct(Utf8("abc"),Int64(1),Utf8("abc"),Int64(2)) |
   +---------------------------------------------------------+
   | {abc: 1, abc: 2}                                        |
   +---------------------------------------------------------+
   1 row(s) fetched. 
   ```
   
   Typically, a struct or map should not have a duplicate key (It would cause 
some problems when getting data). In DuckDB, the query will fail if exist the 
duplicate keys.
   ```
   D select map_from_entries([('a',null),('a',2)]);
   Invalid Input Error: Map keys must be unique.
   ```
   
   I'm unsure where we should handle this issue (DataFusion or Arrow). To solve 
it, I prefer to fix `MapArray` and `StructArray` on the Arrow side.


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