bigquery sum函数正在返回(-0.0)处理float数据类型。真的很惊讶看到负零。它只在对float数据类型应用window函数时发生,如下所示。
select sum(x) over (partition by test) from (SELECT x,test FROM UNNEST([-5.5,5.5]) AS x, UNNEST(['ab','ab']) as test); **--returns -0.0**
但对于整型数据,它的计算是很好的。
select sum(x) over (partition by test) from (SELECT x,test FROM UNNEST([-5,5]) AS x, UNNEST(['ab','ab']) as test); **--returns 0.0**
任何想法都将不胜感激。
暂无答案!
目前还没有任何答案,快来回答吧!