[ https://issues.apache.org/jira/browse/PARQUET-1440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16645176#comment-16645176 ]
ASF GitHub Bot commented on PARQUET-1440: ----------------------------------------- zivanfi closed pull request #530: PARQUET-1440: Convert int32 or int64 decimal values to BigDecimals URL: https://github.com/apache/parquet-mr/pull/530 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/parquet-tools/src/main/java/org/apache/parquet/tools/read/SimpleRecordConverter.java b/parquet-tools/src/main/java/org/apache/parquet/tools/read/SimpleRecordConverter.java index c07875ab8..7a1c81d6f 100644 --- a/parquet-tools/src/main/java/org/apache/parquet/tools/read/SimpleRecordConverter.java +++ b/parquet-tools/src/main/java/org/apache/parquet/tools/read/SimpleRecordConverter.java @@ -172,6 +172,16 @@ public DecimalConverter(String name, int scale) { public void addBinary(Binary value) { record.add(name, new BigDecimal(new BigInteger(value.getBytes()), scale)); } + + @Override + public void addInt(int value) { + record.add(name, BigDecimal.valueOf(value).movePointLeft(scale)); + } + + @Override + public void addLong(long value) { + record.add(name, BigDecimal.valueOf(value).movePointLeft(scale)); + } } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Parquet-tools: Decimal values stored in an int32 or int64 in the parquet file > aren't displayed with their proper scale > ---------------------------------------------------------------------------------------------------------------------- > > Key: PARQUET-1440 > URL: https://issues.apache.org/jira/browse/PARQUET-1440 > Project: Parquet > Issue Type: Bug > Components: parquet-mr > Affects Versions: 1.10.0 > Reporter: Ryan Gardner > Priority: Major > Labels: pull-request-available > > When working with the parquet-tools, I noticed that decimal values that were > stored with int32 or int64 were not being displayed properly. > I opened up a pull request to fix this: > https://github.com/apache/parquet-mr/pull/530#issuecomment-428137066 -- This message was sent by Atlassian JIRA (v7.6.3#76005)