You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2021/08/16 15:29:38 UTC

[GitHub] [orc] dongjoon-hyun commented on a change in pull request #743: ORC-834: Do Not Convert to String in DecimalFromTimestampTreeReader

dongjoon-hyun commented on a change in pull request #743:
URL: https://github.com/apache/orc/pull/743#discussion_r689639185



##########
File path: java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
##########
@@ -962,7 +963,10 @@ public void setConvertVectorElement(int elementNum) throws IOException {
         seconds += 1;
         nanos = 1_000_000_000 - nanos;
       }
-      HiveDecimal value = HiveDecimal.create(String.format("%d.%09d", seconds, nanos));
+      BigDecimal secondsBd = new BigDecimal(seconds);
+      BigDecimal nanosBd = new BigDecimal(nanos).movePointLeft(9);
+      BigDecimal resultBd = (seconds >= 0L) ? secondsBd.add(nanosBd) : secondsBd.subtract(nanosBd);

Review comment:
       Do you have a test coverage for this negative second case? If we don't have, could you make one please?




-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org