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

caican updated SPARK-37382:
---------------------------
    Description: 
In Spark3.1, the `with as` clause in the same SQL is executed multiple times,  
got 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!

Why does Spark3.1.2 return different results?

Has anyone encountered this problem?

  was:
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?


> `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
>            Priority: Major
>
> In Spark3.1, the `with as` clause in the same SQL is executed multiple times, 
>  got 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!
> Why does Spark3.1.2 return different results?
> Has anyone encountered this problem?



--
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