简体   繁体   中英

netezza Double Precision Output Truncates Vaules

I've noticed that the nzsql and 'nzunload' just truncates double precision column's mantissa values. Here is the issue:

select tot_amt from table1;

tot_amt
~~~~~~~    
123.124    
567.678

while when I use other clients like Aginity for Data analytics - the output I get is

tot_amt
~~~~~~~
123.1240535
567.6780122

Also I've found the 'truncation' happens when netezza encounters 0 after 3 mantissa digits.

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. 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.

I can reproduce this issue where I have a table created with column as FLOAT(6) such as:

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM