I've been using Google BigQuery's legacy SQL for a while and when I need the number Pi, there is a convenient PI() function:
SELECT PI()
But in Standard SQL, this function no longer exists. I have been unable to find an equivalent function in the docs. What would be the easiest, most accurate way to have an equivalent of the PI() function in Standard SQL?
Yet another alternative is to use built-in trigonometric functions - arc cosine of -1 will be exactly PI:
SELECT ACOS(-1)
results in
Row f0_
1 3.141592653589793
If you use ACOS(-1) inside your query, it will be automatically constant folded by the optimizer and computed only once.