【发布时间】:2020-03-03 07:34:01
【问题描述】:
我在 Redshift 数据中有两个度量列:
两列的数据类型均为Double Precision,大小为53
colA colB
590437.223579 350213.276421
142069.091151 76554.205749
119372.370247 23001.207853
Null Null
0 0
678.345678 0
0 24567.567866
我想做一些这样的操作:
sum(colA/(colA+ colB)) over (partition by some_other_col) as agg
它让我除以零错误。
所以我做到了:
sum(cast(colA as decimal(3,2)) /nullif((cast(colA as decimal(3,2)) + cast (colB as decimal(3,2))),0)) over (partition by some_other_col) as agg
它再次向我抛出错误:
InternalError_: Numeric data overflow (scale float to decimal)
DETAIL:
-----------------------------------------------
error: Numeric data overflow (scale float to decimal)
code: 1058
context: 64 bit overflow
query: 3941320
location: numeric_bound.cpp:72
如何解决?
【问题讨论】:
标签: sql amazon-web-services amazon-redshift