goldmedal opened a new issue, #15233: URL: https://github.com/apache/datafusion/issues/15233
### Is your feature request related to a problem or challenge? After https://github.com/apache/datafusion/pull/15090, we remove the wildacrd expression from the logical plan layer. The unparser will generate the real column name for the select item. The unparsing result (https://github.com/apache/datafusion/pull/15090#discussion_r1989018918) of an unnest plan would like as below: SELECT "UNNEST(make_array(Int64(1),Int64(2),Int64(3)))" FROM UNNEST([1, 2, 3]) It's only executable for DataFusion. Other databases won't use this kind of column name. ## Postgres and DuckDB using unnest as the column name. ``` psql=# select * from unnest(array[1,2,3]); unnest -------- 1 2 3 (3 rows) psql=# select unnest from unnest(array[1,2,3]); unnest -------- 1 2 3 (3 rows) ``` ## BigQuery ``` select * from unnest(array[1,2,3]) --- f0_ 1 2 3 ``` However, we can't select f0_ directly. ``` select f0_ from unnest(array[1,2,3]) --- Unrecognized name: f0_ at [1:8] ``` ### Describe the solution you'd like I think maybe we can unparse the unnest table factor to `SubqueryAlias` with a default column alias. For example ``` SELECT "UNNEST(make_array(Int64(1),Int64(2),Int64(3)))" FROM UNNEST([1, 2, 3]) as unnest_alias("UNNEST(make_array(Int64(1),Int64(2),Int64(3)))") ``` This way can keep the column name created by DataFusion. The SQL can also be executed by other databases. I think @blaginin's work #14781 pretty matches this approach (https://github.com/apache/datafusion/pull/14781#discussion_r1991936799). Maybe it can solve this issue. ### 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: [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]
