Peter Toth created SPARK-28299:
----------------------------------

             Summary: Evaluation of multiple CTE uses  
                 Key: SPARK-28299
                 URL: https://issues.apache.org/jira/browse/SPARK-28299
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
    Affects Versions: 3.0.0
            Reporter: Peter Toth


This query returns 2 in Spark SQL (ie. the CTE is evaluated twice), but it 
returns 1 in PostgreSQL.
{noformat}
WITH t(x) AS (SELECT random())
SELECT count(*) FROM (
  SELECT * FROM t
  UNION
  SELECT * FROM t
) x
{noformat}

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



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to