Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5181

SUM aggregate function return wong result

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.30.0
    • None
    • core
    • None

    Description

      To reproduce(dummy.iq):

      !use scott
      !set outputformat mysql
      
      SELECT sum(empno) from "scott".emp; 

      Should return 108172, but return -22900.

      This is because RelDataTypeSystemImpl deriveSumType return a wrong datatype. We presume when the parameter is smllInt, the return datatype stay same as the parameter. So the result out of range.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nobigo xiong duan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: