You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "cen yuhai (JIRA)" <ji...@apache.org> on 2016/03/09 11:18:41 UTC

[jira] [Created] (SPARK-13772) DataType mismatch between double and decimal

cen yuhai created SPARK-13772:
---------------------------------

             Summary: DataType mismatch between double and 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


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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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