Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Number datatype looses decimal places

  1. #1
    Join Date
    Feb 2009
    Posts
    2

    Default Number datatype looses decimal places

    When a "table input" column is an arithmetic expresion of all NUMBER(18, 2) operands, the result output column is treated as NUMBER(0, 0) and the actual values looses its decimal places. That is, if the result of the arithmetic expresion is 12345678.47 then the output field is recorded as 12345678.00 in the output stream, and so it goes into the "table output" step.

    Kettle v3.1
    DB postgresql 8.1
    System: Centos 5.2

    Is there a way of forcing kettle to keep its decimal places, or the tell it that the field has to be NUMBER(18, 2) ?

    Thanks,
    Gustavo.

  2. #2
    Join Date
    Aug 2007
    Posts
    10

    Unhappy

    Got the exact same problem :

    1- Extract number from Oracle database with 4 decimal.
    2- In a javascript step, make a sum of both of them and get a result with 1 decimal

    Kettle 3.1.1
    Oracle 10.2.0.4

  3. #3
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    A Number is a double precision floating point value.
    You guys probably mean the String representation of the value?

  4. #4
    Join Date
    Aug 2007
    Posts
    10

    Default

    I am just trying to do this :

    Step 1 : Output Step
    select
    sum(decode(code_indic,'215',reel,0)) NB_LD_T,
    sum(decode(code_indic,'193',reel,0)) NB_LD_P
    from ...

    Step 2 : Javascript Step
    NB_LD = NB_LD_P + NB_LD_T

    Of course there are other calculations so we do not do it directly in the Output Step.

    NB_LD_T and NB_LD_P have 4 decimals
    NB_LD gives 1 decimal

    Thanks for your help
    Last edited by benoit.colas; 10-29-2009 at 02:47 PM.

  5. #5
    Join Date
    Aug 2007
    Posts
    10

    Smile

    Finally got your point !

    Quite strange to got this string representation everywhere in preview in Kettle (Spoon) : only 1 decimal displayed whereas values have more decimals.

    Adding an Alter step with format number 14, 4 #.##### solve the problem

  6. #6
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    File a feature request to add the format mask to the output fields in the JS step. ;-)

  7. #7
    Join Date
    Aug 2007
    Posts
    10

    Default

    Posted in JIRA : PDI-2813

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.