alamb commented on issue #13092: URL: https://github.com/apache/datafusion/issues/13092#issuecomment-2436126313
I think SQL requires the inputs to have the same number of columns Here is an example in postgres ```sql postgres=# create table foo (x int, y int) ; CREATE TABLE postgres=# insert into foo values (1, 1), (1, 2); INSERT 0 2 postgres=# select x from foo UNION ALL select y, y FROM foo; ERROR: each UNION query must have the same number of columns LINE 1: select x from foo UNION ALL select y, y FROM foo; ^ postgres=# select x FROM foo UNION ALL select x, y FROM foo; ``` Perhaps you can get equivalent behavior in DataFusion 42 using a null constant ```sql SELECT "Product" FROM "my_table" UNION ALL SELECT "Product", "Id" FROM "my_table" ``` to ```sql SELECT "Product", NULL FROM "my_table" UNION ALL SELECT "Product", "Id" FROM "my_table" ``` -- 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