shardulm94 commented on a change in pull request #1271:
URL: https://github.com/apache/iceberg/pull/1271#discussion_r464774002



##########
File path: 
spark/src/main/java/org/apache/iceberg/spark/data/SparkOrcValueReaders.java
##########
@@ -195,7 +196,12 @@ public Long nonNullRead(ColumnVector vector, int row) {
     @Override
     public Decimal nonNullRead(ColumnVector vector, int row) {
       HiveDecimalWritable value = ((DecimalColumnVector) vector).vector[row];
-      return new Decimal().set(value.serialize64(value.scale()), 
value.precision(), value.scale());
+      BigDecimal decimal = new 
BigDecimal(BigInteger.valueOf(value.serialize64(value.scale())), value.scale());

Review comment:
       `value.serialize64()` will take in an expected scale as a parameter, so 
I think the only change required to the original code is to pass our expected 
reader scale into `value.serialize64()` instead of passing `value.scale()` and 
passing expected precision and scale to `Decimal.set`.
   
   So this would look like `return new Decimal().set(value.serialize64(scale), 
precision, scale);`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to