Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-28024

Incorrect numeric values when out of range

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
    • Target Version/s:

      Description

      For example
      Case 1:

      select tinyint(128) * tinyint(2); -- 0
      select smallint(2147483647) * smallint(2); -- -2
      select int(2147483647) * int(2); -- -2
      SELECT smallint((-32768)) * smallint(-1); -- -32768
      

      Case 2:

      spark-sql> select cast('10e-70' as float), cast('-10e-70' as float);
      0.0	-0.0
      

      Case 3:

      spark-sql> select cast('10e-400' as double), cast('-10e-400' as double);
      0.0	-0.0
      

      Case 4:

      spark-sql> select exp(-1.2345678901234E200);
      0.0
      
      postgres=# select exp(-1.2345678901234E200);
      ERROR:  value overflows numeric format
      

        Attachments

        1. SPARK-28024.png
          51 kB
          Yuming Wang

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                yumwang Yuming Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: