Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-2536

Return of aggregation functions do not have the correct data type and precision

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.6.0
    • None
    • None

    Description

      ANSI SQL specifies that

      If SUM is specified and DT is exact numeric with scale
      S, then the data type of the result is exact numeric with
      implementation-defined precision and scale S.
      ...
      If DT is approximate numeric, then the data type of the
      result is approximate numeric with implementation-defined
      precision not less than the precision of DT.

      However, when summing integer types (first operand) with float or double (second operand), Phoenix returns the value with the same data type as the first operand.

      Doing a sum with the first operand being a FLOAT or DOUBLE will return a DECIMAL with a fixed scale of 4.

      Doing any multiplication or division will also result in a DECIMAL with scale 4.

      In all of the cases outlined above, the return data type does not meet the ANSI standard.

      Attachments

        Issue Links

          Activity

            People

              kliew Kevin Liew
              kliew Kevin Liew
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: