spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juan Pumarino (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SPARK-19754) Casting to int from a JSON-parsed float rounds instead of truncating
Date Mon, 27 Feb 2017 20:35:45 GMT
Juan Pumarino created SPARK-19754:
-------------------------------------

             Summary: Casting to int from a JSON-parsed float rounds instead of truncating
                 Key: SPARK-19754
                 URL: https://issues.apache.org/jira/browse/SPARK-19754
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.1.0, 1.6.3
            Reporter: Juan Pumarino
            Priority: Minor


When retrieving a float value from a JSON document, and then casting it to an integer, Hive
simply truncates it, while Spark is rounding up when the decimal value is >= 5.

In Hive, the following query returns {{1}}, whereas in a Spark shell the result is {{2}}.

{code}
SELECT CAST(get_json_object('{"a": 1.6}', '$.a') AS INT)
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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


Mime
View raw message