[英]netezza Double Precision Output Truncates Vaules
I've noticed that the nzsql and 'nzunload' just truncates double precision column's mantissa values. 我注意到nzsql和'nzunload'只是截断了双精度列的尾数值。 Here is the issue:
这是问题:
select tot_amt
from table1; 从表1中选择
tot_amt
;
tot_amt
~~~~~~~
123.124
567.678
while when I use other clients like Aginity for Data analytics - the output I get is 而当我使用Aginity等其他客户端进行数据分析时,我得到的输出是
tot_amt
~~~~~~~
123.1240535
567.6780122
Also I've found the 'truncation' happens when netezza encounters 0 after 3 mantissa digits. 我也发现当netezza在3个尾数位遇到0时发生 “截断” 。
We are trying to migrate this db to oracle and due to this issue the entire project is messed and the client doesn't trust our migration scripts. 我们正在尝试将此数据库迁移到oracle,由于这个问题,整个项目陷入混乱,并且客户端不信任我们的迁移脚本。 Has anyone encountered this issue?
有没有人遇到这个问题? The only workaround, even frmo IBM engineer is to cast it
TO_CHAR( '999,999.999', col )
This will kill the unload scripts if I have to do it for billions of rows. 唯一的解决方法,即使是frmo IBM工程师,也要强制将其
TO_CHAR( '999,999.999', col )
如果我必须执行数十亿行TO_CHAR( '999,999.999', col )
这将TO_CHAR( '999,999.999', col )
卸载脚本。
I can reproduce this issue where I have a table created with column as FLOAT(6) such as: 当我有一个以FLOAT(6)列创建的表时,我可以重现此问题,例如:
USERDB.USER(USER)=> create table ZZ (
USERDB.USER(USER)(> YY FLOAT(6)
USERDB.USER(USER)(> );
CREATE TABLE
USERDB.USER(USER)=> insert into ZZ (yy) values (123.123456789);
INSERT 0 1
USERDB.USER(USER)=> insert into ZZ (yy) values (12.123456789);
INSERT 0 1
USERDB.USER(USER)=> select * from ZZ;
YY
---------
123.123
12.1234
(2 rows)
USERDB.USER(USER)=> select CAST ( YY as FLOAT(15) ) from ZZ;
?COLUMN?
----------------
123.1234588623
12.123399734497
(2 rows)
USERDB.USER(USER)=>
I can cast the column values to a wider type, however the problem I see is that the value I inserted is not the same as the value returned. 我可以将列值转换为更广泛的类型,但是我看到的问题是我插入的值与返回的值不同。 And the same is true if I use Aginity also to query, the values are incorrect.
如果我也使用Aginity进行查询,则同样如此,这些值是不正确的。
Check the precision (and scale) of the 'tot_amt' column in table1, I guess the data type used to store values is quite small (FLOAT(6) maybe?), and NZSQL is telling you the correct values as enforced by the data type. 检查表1中'tot_amt'列的精度(和小数位数),我猜用于存储值的数据类型非常小(可能是FLOAT(6)?),并且NZSQL告诉您数据强制执行的正确值类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.