I have two tables that I am trying to UNION. Column id in table1 is of type STRING. I do not have that column in table2 so I am writing SELECT NULL AS id FROM table2 but BigQuery thinks that column id in table2 is of type INT64.
I get this error -
Column 2 in UNION ALL has incompatible types: STRING, INT64.
Query works if I write SELECT "" AS id FROM table2 instead.
cast(null as string)STRING(NULL)should work as well