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

   ### Is your feature request related to a problem or challenge?
   
   As discussed in 
https://github.com/apache/datafusion/pull/11361#issuecomment-2221111658, I file 
this issue.
   In most databases, the struct type (aka row or record type) doesn't allows 
the duplicate field name and null name. However, both of them are allowed in 
DataFusion:
   ```sql
   query I
   select {'scalar': 27, null: 1, 'null': NULL}['null'];
   ----
   1
   
   query I
   select {'scalar': 27, 'scalar': 1, 'null': NULL}['scalar'];
   ----
   27
   ```
   They cause some weird behaviors if created from duplicate or null names.
   
   Similar behaviors are not allowed by other databases (e.g. DuckDB):
   ```sql
   D select {'1':1, '1':1};
   Binder Error: Duplicate struct entry name "1"
   D select {'1':1, null:1};
   Parser Error: syntax error at or near "null"
   LINE 1: select {'1':1, null:1};
                          ^
   ```
   
   As @alamb mentioned 
https://github.com/apache/datafusion/pull/11361#issuecomment-2221111658, the 
spec of `StructArray` doesn't say anything about those limitations. We might 
need to handle this behavior in DataFusion.
   
   ### Describe the solution you'd like
   
   We should check if the duplicate or null name exists when invoking 
`named_struct`.
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


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