lyne7-sc opened a new issue, #23878: URL: https://github.com/apache/datafusion/issues/23878
### Describe the bug CTAS with an explicit schema fails when qualified source columns have the same unqualified name. ### To Reproduce ```sql CREATE TABLE dup_src AS VALUES (1, 2); CREATE TABLE dup_ctas_with_schema(left_c1 BIGINT, right_c1 BIGINT) AS SELECT dup_src.column1, right_src.column1 FROM dup_src CROSS JOIN (SELECT column2 AS column1 FROM dup_src) right_src; ``` The second statement fails with: `Error: Schema error: Ambiguous reference to unqualified field column1` ### Expected behavior The `CREATE TABLE` statement should succeed because the source columns are qualified and the target column names are unique. ### 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]
