You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by vb...@apache.org on 2020/07/15 14:31:10 UTC

[hudi] branch master updated: [HUDI-1087] Handle decimal type for realtime record reader with SparkSQL (#1831)

This is an automated email from the ASF dual-hosted git repository.

vbalaji pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new bf1d36f  [HUDI-1087] Handle decimal type for realtime record reader with SparkSQL (#1831)
bf1d36f is described below

commit bf1d36fa639cae558aa388d8d547e58ad2e67aba
Author: wenningd <we...@gmail.com>
AuthorDate: Wed Jul 15 07:30:58 2020 -0700

    [HUDI-1087] Handle decimal type for realtime record reader with SparkSQL (#1831)
    
    Co-authored-by: Wenning Ding <we...@amazon.com>
---
 .../apache/hudi/hadoop/utils/HoodieRealtimeRecordReaderUtils.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/utils/HoodieRealtimeRecordReaderUtils.java b/hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/utils/HoodieRealtimeRecordReaderUtils.java
index cec77f9..e925c18 100644
--- a/hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/utils/HoodieRealtimeRecordReaderUtils.java
+++ b/hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/utils/HoodieRealtimeRecordReaderUtils.java
@@ -33,6 +33,8 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.HiveDecimalUtils;
 import org.apache.hadoop.io.ArrayWritable;
 import org.apache.hadoop.io.BooleanWritable;
 import org.apache.hadoop.io.BytesWritable;
@@ -210,9 +212,8 @@ public class HoodieRealtimeRecordReaderUtils {
           LogicalTypes.Decimal decimal = (LogicalTypes.Decimal) LogicalTypes.fromSchema(schema);
           HiveDecimalWritable writable = new HiveDecimalWritable(((GenericFixed) value).bytes(),
               decimal.getScale());
-          return HiveDecimalWritable.enforcePrecisionScale(writable,
-              decimal.getPrecision(),
-              decimal.getScale());
+          return HiveDecimalUtils.enforcePrecisionScale(writable,
+              new DecimalTypeInfo(decimal.getPrecision(), decimal.getScale()));
         }
         return new BytesWritable(((GenericFixed) value).bytes());
       default: