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

   ### Describe the bug
   
   When selecting all (`*`) columns of the result of joining two tables, "not 
friendly" error message shows up. I believe the message could be better.
   
   ```
   Failed due to a difference in schemas, original schema: DFSchema { inner: 
Schema { fields: [Field { name: "name", data_type: Utf8, nullable: false, 
dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "age", 
data_type: Int32, nullable: false, dict_id: 0, dict_is_ordered: false, 
metadata: {} }, Field { name: "name", data_type: Utf8, nullable: true, dict_id: 
0, dict_is_ordered: false, metadata: {} }, Field { name: "job", data_type: 
Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }], 
metadata: {} }, field_qualifiers: [Some(Bare { table: "_0" }), None, Some(Bare 
{ table: "_2" }), None], functional_dependencies: FunctionalDependencies { 
deps: [] } }, new schema: DFSchema { inner: Schema { fields: [Field { name: 
"_0.name", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: 
false, metadata: {} }, Field { name: "age", data_type: Int32, nullable: false, 
dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "_2.name", 
data_type: Ut
 f8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field 
{ name: "job", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: 
false, metadata: {} }], metadata: {} }, field_qualifiers: [None, None, None, 
None], functional_dependencies: FunctionalDependencies { deps: [] } }.
   ```
   
   ### To Reproduce
   
   the below SQL fails (see below for definitions of source tables)
   
   ```sql
   SELECT * FROM age LEFT JOIN job ON age.name = job.name
   ```
   
   ```sql
   -- age
   SELECT 'Alice' AS name, 25 AS age
   UNION ALL
   SELECT 'Bob', 30
   UNION ALL
   SELECT 'Charlie', 28
   
   -- job
   SELECT 'Alice' AS name,
       'Engineer' AS job
   UNION ALL
   SELECT 'Bob','Designer'
   UNION ALL
   SELECT 'Charlie','Manager'
   ```
   
   
   ### Expected behavior
   
   It would give a better message about ambiguous column names and specifically 
call out `name` as the problem
   
   ### 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: [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