I was trying to use a user defined query in web big query UI. According to documentation, https://cloud.google.com/bigquery/sql-reference/user-defined-functions, I did this step by step.
- Uncheck the Use Legacy SQL checkbox.
- type this in Query Editor
Codes below are the same as https://cloud.google.com/bigquery/sql-reference/user-defined-functions
CREATE TEMPORARY FUNCTION timesTwo(x INT64)
RETURNS INT64
LANGUAGE js AS """
return x*2;
""";
3. Below the UDF statement, type your query.
SELECT timesTwo(numbers) as doubles
FROM UNNEST([1, 2, 3, 4, 5]) AS numbers;
Then I clicked Run Query but gives me error like this
Not Implemented: UDFs are currently only supported for legacy SQL queries.
Is it because of the legacy SQL option? But I unchecked it as the document says.
INT64--due to the limitations of JavaScript, there is no way of losslessly representing anINT64aside from as a decimal string. We're working on a change to indicate thatFLOAT64is the preferred way of passing numbers as input. - Elliott Brossard