Assigned
Status Update
Comments
va...@google.com <va...@google.com>
ar...@google.com <ar...@google.com> #2
Hello,
This issue report has been forwarded to the Cloud BigQuery Product team so that they may investigate it, but there is no ETA for a resolution today. Future updates regarding this issue will be provided here.
Description
Problem you have encountered
When using the
AVG
aggregation and some values areInfinity
, the result isNaN
, which is numerically incorrect. For instance, consider a subquery where two values areInfinity
and you want the average.Infinity
+Infinity
isInfinity
, andInfinity
divided by 2 is alsoInfinity
. In BigQuery a query like this is producingNaN
and notInfinity
.What you expected to happen:
My expectation is that we return numerically correct
AVG
values whenever possible, even whenInfinity
values are present.Steps to reproduce:
Run some of the queries below:
As can be seen, the expected
avg
for those two queries isInfinity
but BigQuery returnsNaN
Other information (workarounds you have tried, documentation consulted, etc):
Changing the query to the pattern below returns the expected results
Trying the query in other engines such as Postgres returns expected results: