[ 
https://issues.apache.org/jira/browse/SPARK-15557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15303663#comment-15303663
 ] 

Takeshi Yamamuro commented on SPARK-15557:
------------------------------------------

I couldn't reproduce this and I missed any precondition?
I used master at commit 3fca635b4ed322208debcd89a539e42cdde6bbd4.
{code}
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /___/ .__/\_,_/_/ /_/\_\   version 2.0.0-SNAPSHOT
      /_/
         
Using Scala version 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_31)
Type in expressions to have them evaluated.
Type :help for more information.

scala> sql("select (cast(99 as decimal(19,6)) + 3) * 2.3")
res0: org.apache.spark.sql.DataFrame = [(CAST((CAST(CAST(99 AS DECIMAL(19,6)) 
AS DECIMAL(20,6)) + CAST(CAST(3 AS DECIMAL(10,0)) AS DECIMAL(20,6))) AS 
DECIMAL(20,6)) * CAST(2.3 AS DECIMAL(20,6))): decimal(23,7)]

scala> sql("select (cast(99 as decimal(19,6)) + 3) * 2.3").show
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
|(CAST((CAST(CAST(99 AS DECIMAL(19,6)) AS DECIMAL(20,6)) + CAST(CAST(3 AS 
DECIMAL(10,0)) AS DECIMAL(20,6))) AS DECIMAL(20,6)) * CAST(2.3 AS 
DECIMAL(20,6)))|
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                               
                                                                234.6000000|
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
{code}

> expression ((cast(99 as decimal) + '3') * '2.3' ) return null
> -------------------------------------------------------------
>
>                 Key: SPARK-15557
>                 URL: https://issues.apache.org/jira/browse/SPARK-15557
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.6.1, 2.0.0
>         Environment: spark1.6.1
>            Reporter: cen yuhai
>
> expression "select  (cast(99 as decimal(19,6))+ '3')*'2.3' " will return null
> expression "select  (cast(40 as decimal(19,6))+ '3')*'2.3' "  is OK
> I find that maybe it will be null if the result is more than 100



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

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

Reply via email to