Uploaded image for project: 'Pentaho Data Integration - Kettle'
  1. Pentaho Data Integration - Kettle
  2. PDI-16072

In Select values step, when converting a value of BigNumber to boolean, if the original value is outside the value range of Integer, it results in an Incorrect result.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Severity: Urgent
    • Resolution: Fixed
    • Affects Version/s: 6.1.0.1 GA, 7.0.0 GA
    • Fix Version/s: 7.1.0 GA
    • Component/s: Step
    • Story Points:
      0
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.
    • Sprint Team:
      Tatooine (Maint)
    • Steps to Reproduce:
      Hide

      Environment details:

      Pentaho : Pentaho v6.1.0.1 and 7.0
      OS : Windows 7 (x64)
      JDK : java version "1.8.0_77"
      Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
      Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
      Pentaho installation : archive

      Reproduction procedure
      (1) Double click "spoon.bat"
      (2) Execute attached KTR file

      Show
      Environment details: Pentaho : Pentaho v6.1.0.1 and 7.0 OS : Windows 7 (x64) JDK : java version "1.8.0_77" Java(TM) SE Runtime Environment (build 1.8.0_77-b03) Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode) Pentaho installation : archive Reproduction procedure (1) Double click "spoon.bat" (2) Execute attached KTR file

      Description

      In Select values step, when converting a value of BigNumber to boolean, if the original value is outside the value range of Integer, it results in an incorrect result.

      In following case (3), the value is not zero, so the boolean value should be true.

      Input Data:
      (1)86400 (Integer)
      (2)1.7976E308 (Number)
      (3)1.7976E308 (BigNumber)
      (4)0 (Integer)
      (5)0 (Number)
      (6)0 (BigNumber)
      (7)1 (Integer)
      (8)1 (Number)
      (9)1 (BigNumber)

      Assumed result:
      (1)Y
      (2)Y
      (3)Y
      (4)N
      (5)N
      (6)N
      (7)Y
      (8)Y
      (9)Y

      Actual result:
      (1)Y
      (2)Y
      (3)N
      (4)N
      (5)N
      (6)N
      (7)Y
      (8)Y
      (9)Y

      If the Select values step use java.math.BigDecimal.intValue(), the value 1.7976E30 is too big to fit in an Integer,
      only the low-order 32 bits are returned, then the value is zero.

      https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html#intValue--

      Thus, the value is handled as zero, so the converted value from BigNumber to Boolean becomes false.
      It is better to evaluate whether the value is 0 and convert it to a Boolean value.

        Attachments

        1. 369.ktr
          15 kB
        2. 369.ktr
          11 kB

          Activity

            People

            Assignee:
            upihin Uladzimir Pihin (Inactive)
            Reporter:
            gdev Gurudev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: