Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BigQuery: "Invalid function name"

In BigQuery, I ran this query

SELECT SEC_TO_TIMESTAMP(start_time), resource
FROM [logs.requestlogs_20140305]

and received the error

Error: Invalid function name: SEC_TO_TIMESTAMP

SEC_TO_TIMESTAMP is listed in the date functions reference, so why does this error come up?

like image 751
Sophie Alpert Avatar asked May 18 '26 07:05

Sophie Alpert


1 Answers

Turns out my start_time column was of type float, not an integer which SEC_TO_TIMESTAMP expects. Changing the query to

SELECT SEC_TO_TIMESTAMP(INTEGER(start_time)), resource
FROM [logs.requestlogs_20140305]

fixed the problem.

like image 159
Sophie Alpert Avatar answered May 21 '26 05:05

Sophie Alpert