parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ziva...@apache.org
Subject [parquet-mr] branch master updated: PARQUET-1440: Parquet-tools: Parse int32 or int64 decimal values to big decimals with the proper scale (#530)
Date Wed, 10 Oct 2018 15:54:59 GMT
This is an automated email from the ASF dual-hosted git repository.

zivanfi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-mr.git


The following commit(s) were added to refs/heads/master by this push:
     new 716fb6b  PARQUET-1440: Parquet-tools: Parse int32 or int64 decimal values to big
decimals with the proper scale (#530)
716fb6b is described below

commit 716fb6b3514b05e7b5ad87dea2c3b2ccad4cef60
Author: Ryan Gardner <ryebrye@gmail.com>
AuthorDate: Wed Oct 10 11:54:54 2018 -0400

    PARQUET-1440: Parquet-tools: Parse int32 or int64 decimal values to big decimals with
the proper scale (#530)
---
 .../org/apache/parquet/tools/read/SimpleRecordConverter.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)

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 c07875a..7a1c81d 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 class SimpleRecordConverter extends GroupConverter {
     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));
+    }
   }
 }
 


Mime
View raw message