As of June 2nd 2020 BigQuery supports referencing tables and views in UDF. However, the obvious use case (for me) reverts an error that reads: "Correlated subqueries that reference other tables are not supported unless they can be de-correlated, such as by transforming them into an efficient JOIN."
My query is something like this:
SELECT airport, udf_dataset.getcity(airport) AS city
FROM my_table
And the UDF getcity looks like this:
SELECT city_code FROM my_cities_table
WHERE airport_code = airport_input
The my_cities_table has a 1 on 1 reference of what is the city for each airport.
My guess is that doing a JOIN efficiently gets the city value for each airport, whereas the UDF queries for each airport value, creating the correlation. Is my guess right? If so, then supporting table reference in UDF proves less worthy.