Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 3.1.0
    • None
    • SQL
    • None

    Description

      This query returns 2 in Spark SQL (ie. the CTE is evaluated twice), but it returns 1 in PostgreSQL.

      WITH t(x) AS (SELECT random())
      SELECT count(*) FROM (
        SELECT * FROM t
        UNION
        SELECT * FROM t
      ) x
      

      I tested MSSQL too and it returns 2 as Spark SQL does. Further tests are needed on different DBs...

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              petertoth Peter Toth
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: