[
https://issues.apache.org/jira/browse/SPARK-13772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Cheng Lian updated SPARK-13772:
-------------------------------
Description:
Code snippet to reproduce this issue using 1.6.0:
{code}
select if(1=1, cast(1 as double), cast(1.1 as decimal) as a from test
{code}
It will throw exceptions like this:
{noformat}
Error in query: cannot resolve 'if ((1 = 1)) cast(1 as double) else cast(1.1 as
decimal(10,0))' due to data type mismatch: differing types in 'if ((1 = 1))
cast(1 as double) else cast(1.1 as decimal(10,0))' (double and decimal(10,0)).;
line 1 pos 37
{noformat}
I also tested:
{code}
select if(1=1,cast(1 as decimal),cast(1 as decimal(19,6))) from test;
{code}
{noformat}
Error in query: cannot resolve 'if ((1 = 1)) cast(1 as decimal(10,0)) else
cast(1 as decimal(19,6))' due to data type mismatch: differing types in 'if ((1
= 1)) cast(1 as decimal(10,0)) else cast(1 as decimal(19,6))' (decimal(10,0)
and decimal(19,6)).; line 1 pos 38
{noformat}
was:
I found a bug:
select if(1=1, cast(1 as double), cast(1.1 as decimal) as a from test
It will throw exceptions like this:
Error in query: cannot resolve 'if ((1 = 1)) cast(1 as double) else cast(1.1 as
decimal(10,0))' due to data type mismatch: differing types in 'if ((1 = 1))
cast(1 as double) else cast(1.1 as decimal(10,0))' (double and decimal(10,0)).;
line 1 pos 37
I also test:
select if(1=1,cast(1 as decimal),cast(1 as decimal(19,6))) from test;
Error in query: cannot resolve 'if ((1 = 1)) cast(1 as decimal(10,0)) else
cast(1 as decimal(19,6))' due to data type mismatch: differing types in 'if ((1
= 1)) cast(1 as decimal(10,0)) else cast(1 as decimal(19,6))' (decimal(10,0)
and decimal(19,6)).; line 1 pos 38
> DataType mismatch about decimal
> -------------------------------
>
> Key: SPARK-13772
> URL: https://issues.apache.org/jira/browse/SPARK-13772
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.6.0
> Environment: spark1.6.0 hadoop2.2.0 jdk1.7.0_79
> Reporter: cen yuhai
>
> Code snippet to reproduce this issue using 1.6.0:
> {code}
> select if(1=1, cast(1 as double), cast(1.1 as decimal) as a from test
> {code}
> It will throw exceptions like this:
> {noformat}
> Error in query: cannot resolve 'if ((1 = 1)) cast(1 as double) else cast(1.1
> as decimal(10,0))' due to data type mismatch: differing types in 'if ((1 =
> 1)) cast(1 as double) else cast(1.1 as decimal(10,0))' (double and
> decimal(10,0)).; line 1 pos 37
> {noformat}
> I also tested:
> {code}
> select if(1=1,cast(1 as decimal),cast(1 as decimal(19,6))) from test;
> {code}
> {noformat}
> Error in query: cannot resolve 'if ((1 = 1)) cast(1 as decimal(10,0)) else
> cast(1 as decimal(19,6))' due to data type mismatch: differing types in 'if
> ((1 = 1)) cast(1 as decimal(10,0)) else cast(1 as decimal(19,6))'
> (decimal(10,0) and decimal(19,6)).; line 1 pos 38
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]