spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Zhang (JIRA)" <>
Subject [jira] [Commented] (SPARK-23498) Accuracy problem in comparison with string and integer
Date Wed, 28 Feb 2018 04:13:00 GMT


Kevin Zhang commented on SPARK-23498:

yes, thanks. But when we use spark sql to run existing hive scripts we expected spark sql
could have the same results as hive, and that's why I open this jira. Now that [~q79969786]
has marked this as duplicated with [SPARK-21646 |],
I will patch in my own branch first.

> Accuracy problem in comparison with string and integer
> ------------------------------------------------------
>                 Key: SPARK-23498
>                 URL:
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0, 2.2.1, 2.3.0
>            Reporter: Kevin Zhang
>            Priority: Major
> While comparing a string column with integer value, spark sql will automatically cast
the string operant to int, the following sql will return true in hive but false in spark
> {code:java}
> select '1000.1'>1000
> {code}
>  from the physical plan we can see the string operant was cast to int which caused the
accuracy loss
> {code:java}
> *Project [false AS (CAST(1000.1 AS INT) > 1000)#4]
> +- Scan OneRowRelation[]
> {code}
> To solve it, using a wider common type like double to cast both sides of operant of
a binary operator may be safe.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message