Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-27764 Feature Parity between PostgreSQL and Spark
  3. SPARK-27768

Infinity, -Infinity, NaN should be recognized in a case insensitive manner

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
      None

      Description

      When the inputs contain the constant 'infinity', Spark SQL does not generate the expected results.

      SELECT avg(CAST(x AS DOUBLE)), var_pop(CAST(x AS DOUBLE))
      FROM (VALUES ('1'), (CAST('infinity' AS DOUBLE))) v(x);
      SELECT avg(CAST(x AS DOUBLE)), var_pop(CAST(x AS DOUBLE))
      FROM (VALUES ('infinity'), ('1')) v(x);
      SELECT avg(CAST(x AS DOUBLE)), var_pop(CAST(x AS DOUBLE))
      FROM (VALUES ('infinity'), ('infinity')) v(x);
      SELECT avg(CAST(x AS DOUBLE)), var_pop(CAST(x AS DOUBLE))
      FROM (VALUES ('-infinity'), ('infinity')) v(x);

       The root cause: Spark SQL does not recognize the special constants in a case insensitive way. In PostgreSQL, they are recognized in a case insensitive way. 

      Link: https://www.postgresql.org/docs/9.3/datatype-numeric.html 

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              smilegator Xiao Li
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: