3

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?

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for reporting this. In fact, it's a very confusing error message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.