I'm trying to create simple user-defined function in BigQuery using sql query like this:
CREATE OR REPLACE FUNCTION
distance_traveled_between_time(id STRING,
starttime TIMESTAMP,
endtime TIMESTAMP)
RETURNS FLOAT64 AS (
(
SELECT SUM(fueltanklevel) FROM `eva-boa-inf2.evaboa.gpsapi`
)
)
Note: this is not the real function, it's just dummy function that return float value
I think, this is a valid SQL statement, but I have this error:
Routine name "distance_traveled_between_time" missing dataset while no default dataset is set in the request.
And I don't know what to fix at this point. Anyone knows?
Add the dataset to the name of the routine:
look here-^