sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Lindholm (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SQOOP-3285) Hcatalog import is loosing precision on DECIMAL fields
Date Fri, 09 Feb 2018 19:22:00 GMT
Greg Lindholm created SQOOP-3285:
------------------------------------

             Summary: Hcatalog import is loosing precision on DECIMAL fields
                 Key: SQOOP-3285
                 URL: https://issues.apache.org/jira/browse/SQOOP-3285
             Project: Sqoop
          Issue Type: Bug
          Components: hive-integration
    Affects Versions: 1.4.7
            Reporter: Greg Lindholm


Import with hcatalog for DECIMAL fields is loosing precision.

The bug is in org.apache.sqoop.mapreduce.hcat.SqoopHCatImportHelper.convertNumberTypes()

Internally the BigDecimal value is converted to a Double then back into a BigDecimal.

As a test I imported from a MySQL db a DECIMAL(38,8) field:
{code:java}
create table sampledata1 ( n38 DECIMAL(38,8) );
insert into sampledata1 ( n38 ) values ( -123456789012345678901234567890.12345678 )

sqoop import \
  --connect jdbc:mysql://10.210.144.22:3306/greg --username greg -P \
  -m 1 \
  --table sampledata1 \
  --hcatalog-table sampledata1_orc2 \
  --create-hcatalog-table \
  --hcatalog-storage-stanza 'stored as orc'


{code}
The result in the hive table does not match the input.
{noformat}
Original:
-123456789012345678901234567890.12345678
Result:
-123456789012345677877719597056.00000000{noformat}
I get the same result with Orc, RCfile, and Avro files.

 

I believe I found the problem and will provide a patch shortly.

 

 



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

Mime
View raw message