Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-23614

The resulting scale of TRUNCATE(DECIMAL, ...) is not correct

    XMLWordPrintableJSON

Details

    Description

      Run the following SQL

      SELECT
        TRUNCATE(123.456, 2),
        TRUNCATE(123.456, 0),
        TRUNCATE(123.456, -2),
        TRUNCATE(CAST(123.456 AS DOUBLE), 2),
        TRUNCATE(CAST(123.456 AS DOUBLE), 0),
        TRUNCATE(CAST(123.456 AS DOUBLE), -2)
      

      The result is

      123.450
      123.000
      100.000
      123.45
      123.0
      100.0
      

      It seems that the resulting scale of TRUNCATE(DECIMAL, ...) is the same as that of the input decimal.

      Attachments

        Issue Links

          Activity

            People

              paul8263 Yao Zhang
              TsReaper Caizhi Weng
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: