[ 
https://issues.apache.org/jira/browse/SPARK-28299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Peter Toth resolved SPARK-28299.
--------------------------------
    Resolution: Duplicate

> 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.1.0
>            Reporter: Peter Toth
>            Priority: Major
>
> 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
(v8.20.1#820001)

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

Reply via email to