The documentation for SQL-based UDFs is sparse. I'm wondering if it's possible to write a full-fledged SELECT clause, using the UDF parameters in the query. So in effect, each invocation of the UDF would result in a subquery.
Contrived example:
CREATE TEMP FUNCTION foo(bar STRING) AS (
SELECT * FROM `example.latest` WHERE thing = bar
);
SELECT foo('abc')
BigQuery gives the error "Syntax error: Unexpected keyword SELECT; failed to parse CREATE [TEMP] FUNCTION statement" so I assume it's not possible, but would love to get confirmation.