[ https://issues.apache.org/jira/browse/SPARK-40563 ]


    zzzzming95 deleted comment on SPARK-40563:
    ------------------------------------

was (Author: zing):
The issue has been fixed in the latest master branch.

> Error at where clause, when sql case executes by else branch
> ------------------------------------------------------------
>
>                 Key: SPARK-40563
>                 URL: https://issues.apache.org/jira/browse/SPARK-40563
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.3.0
>            Reporter: Vadim
>            Priority: Major
>             Fix For: 3.3.1
>
>         Attachments: java-code-example.txt, sql.txt, stack-trace.txt
>
>
> Hello!
> The Spark SQL phase optimization failed with an internal error. Please, fill 
> a bug report in, and provide the full stack trace.
>  - Spark verison 3.3.0
>  - Scala version 2.12
>  - DatasourceV2
>  - Postgres
>  - Postrgres JDBC Driver: 42+
>  - Java8
> Case:
> select
>     case
>         when (t_name = 'foo') then 'foo'
>         else 'default'
>     end as case_when
> from
>     t
> where
>     case
>         when (t_name = 'foo') then 'foo'
>         else 'default'
>     end *= 'foo';  -> works as expected*
> *----------------------------------------------------------*
> select
>     case
>         when (t_name = 'foo') then 'foo'
>         else 'default'
>     end as case_when
> from
>     t
> where
>     case
>         when (t_name = 'foo') then 'foo'
>         else 'default'
>     end *= 'default'; -> query throw ex;*
> In where clause when we try find rows by else branch, spark thrown exception:
> The Spark SQL phase optimization failed with an internal error. Please, fill 
> a bug report in, and provide the full stack trace.
> Caused by: java.lang.AssertionError: assertion failed
>     at scala.Predef$.assert(Predef.scala:208)
>  
> org.apache.spark.sql.execution.datasources.v2.PushablePredicate.$anonfun$unapply$1(DataSourceV2Strategy.scala:589)
> At debugger def unapply in PushablePredicate.class
> when sql case return 'foo' -> function unapply accept: (t_name = 'foo'), as 
> instance of Predicate
> when sql case return 'default' -> function unapply accept: COALESCE(t_name = 
> 'foo', FALSE) as instance of GeneralScalarExpression and assertation failed 
> with error
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to