You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Araika Singh (Jira)" <ji...@apache.org> on 2024/12/19 17:46:00 UTC
[jira] [Updated] (HIVE-28673) Fix issues in JSON SerDe implementations related to Decimal
[ https://issues.apache.org/jira/browse/HIVE-28673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Araika Singh updated HIVE-28673:
--------------------------------
Description:
Decimal values that are inserted by user are not interpreted correctly. This can lead to data issues for users needing decimal precision to a certain point.
+*Steps to reproduce:*+
{code:java}
// json text value for some reference {"decimalcol1" : -9999999999999999.99, "decimalcol2" : 9999999999999999.99, "decimalcol3" : 1000000000000000000000000000000000000.00, "decimalcol4" : 99.999 , "decimalcol5" : 1e39}
create table json_serde (
decimalcol1 decimal(18,2),
decimalcol2 decimal(38,2),
decimalcol3 decimal(38,2),
decimalcol4 decimal(18,2),
decimalcol5 decimal(38,2))
row format serde 'org.apache.hadoop.hive.serde2.JsonSerDe';
INSERT INTO TABLE json_serde VALUES (-9999999999999999.99, 9999999999999999.99, 1000000000000000000000000000000000000.00, 99.999, 1e39);
OR
LOAD DATA LOCAL INPATH 'path/to/json.txt' into table json_serde;
select * from json_serde;{code}
+*Output:*+
{noformat}
+--------------+-----------------------+--------------+--------------+--------------+
| decimalcol1 | decimalcol2 | decimalcol3 | decimalcol4 | decimalcol5 |
+--------------+-----------------------+--------------+--------------+--------------+
| NULL | 10000000000000000.00 | NULL | 100.00 | NULL |
+--------------+-----------------------+--------------+--------------+--------------+{noformat}
The above behaviour should not happen.
> Fix issues in JSON SerDe implementations related to Decimal
> -----------------------------------------------------------
>
> Key: HIVE-28673
> URL: https://issues.apache.org/jira/browse/HIVE-28673
> Project: Hive
> Issue Type: Bug
> Reporter: Araika Singh
> Assignee: Araika Singh
> Priority: Major
>
> Decimal values that are inserted by user are not interpreted correctly. This can lead to data issues for users needing decimal precision to a certain point.
> +*Steps to reproduce:*+
> {code:java}
> // json text value for some reference {"decimalcol1" : -9999999999999999.99, "decimalcol2" : 9999999999999999.99, "decimalcol3" : 1000000000000000000000000000000000000.00, "decimalcol4" : 99.999 , "decimalcol5" : 1e39}
> create table json_serde (
> decimalcol1 decimal(18,2),
> decimalcol2 decimal(38,2),
> decimalcol3 decimal(38,2),
> decimalcol4 decimal(18,2),
> decimalcol5 decimal(38,2))
> row format serde 'org.apache.hadoop.hive.serde2.JsonSerDe';
> INSERT INTO TABLE json_serde VALUES (-9999999999999999.99, 9999999999999999.99, 1000000000000000000000000000000000000.00, 99.999, 1e39);
> OR
> LOAD DATA LOCAL INPATH 'path/to/json.txt' into table json_serde;
> select * from json_serde;{code}
> +*Output:*+
> {noformat}
> +--------------+-----------------------+--------------+--------------+--------------+
> | decimalcol1 | decimalcol2 | decimalcol3 | decimalcol4 | decimalcol5 |
> +--------------+-----------------------+--------------+--------------+--------------+
> | NULL | 10000000000000000.00 | NULL | 100.00 | NULL |
> +--------------+-----------------------+--------------+--------------+--------------+{noformat}
> The above behaviour should not happen.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)