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

zhoukang edited comment on SPARK-23335 at 3/1/18 10:56 AM:
-----------------------------------------------------------

Actually hive return the same result

{code:java}
0: jdbc:hive2://xxx/> select conv('ffffffffffffffff',16,10) % 2;
+------+--+
| _c0  |
+------+--+
| 0.0  |
+------+--+
{code}



was (Author: cane):
Actually hive return the same result

{code:java}
0: jdbc:hive2://c3-hadoop-hive01.bj:18203/> select 
conv('ffffffffffffffff',16,10) % 2;
+------+--+
| _c0  |
+------+--+
| 0.0  |
+------+--+
{code}


> expression 'select conv('ffffffffffffffff',16,10) % 2' return 0
> ---------------------------------------------------------------
>
>                 Key: SPARK-23335
>                 URL: https://issues.apache.org/jira/browse/SPARK-23335
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.1.0
>            Reporter: zhoukang
>            Priority: Major
>
> For below expression:
> {code:java}
> select conv('ffffffffffffffff',16,10) % 2;
> {code}
> it will return 0.
> {code:java}
> 0: jdbc:hive2://xxx:16> select conv('ffffffffffffffff',16,10) % 2;
>  
> +----------------------------------------------------------------------------------------------+--+
>  
> | (CAST(conv(ffffffffffffffff, 16, 10) AS DOUBLE) % CAST(CAST(2 AS 
> DECIMAL(20,0)) AS DOUBLE)) |
>  
> +----------------------------------------------------------------------------------------------+--+
>  | 0.0 | 
> +----------------------------------------------------------------------------------------------+--+
> {code}
> It caused by:
> {code:java}
> case a @ BinaryArithmetic(left @ StringType(), right) => 
> a.makeCopy(Array(Cast(left, DoubleType), right)) 
> case a @ BinaryArithmetic(left, right @ StringType()) => 
> a.makeCopy(Array(left, Cast(right, DoubleType)))
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to