You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "caican (Jira)" <ji...@apache.org> on 2021/11/19 03:13:00 UTC

[jira] [Created] (SPARK-37382) `with as` clause got inconsistent results

caican created SPARK-37382:
------------------------------

             Summary: `with as` clause got inconsistent results
                 Key: SPARK-37382
                 URL: https://issues.apache.org/jira/browse/SPARK-37382
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.1.2
            Reporter: caican


In Spark3.1, the `with as` clause in the same SQL is executed multiple times, with different results

`

with tab as (
 select 'Withas' as name, rand() as rand_number
)
select name, rand_number
from tab
union all
select name, rand_number
from tab

`

!https://internal-api-lark-file.f.mioffice.cn/api/image/keys/img_bcf6f867-6aee-4afe-bc43-30bf4f2dbdel?message_id=7032102765711097965!

But In spark2.3, it got consistent results

`

with tab as (
 select 'Withas' as name, rand() as rand_number
)
select name, rand_number
from tab
union all
select name, rand_number
from tab

`

!https://internal-api-lark-file.f.mioffice.cn/api/image/keys/img_6dc6e44b-d4a5-4b0d-bd2c-00859ec80a1l?message_id=7032104202756751468!

Has anyone encountered this problem?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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