belugabehr commented on a change in pull request #743:
URL: https://github.com/apache/orc/pull/743#discussion_r689661020



##########
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:
       If I break this code intentionally (add instead of subtract), there are 
failures in:
   
   ```
   [ERROR] Failures: 
   [ERROR]   TestProlepticConversions.testSchemaEvolutionTimestamp:375 row 0 
==> expected: <-6212894324588> but was: <-6212894324412>
   [ERROR]   TestProlepticConversions.testSchemaEvolutionTimestamp:375 row 0 
==> expected: <-6212877044588> but was: <-6212877044412>
   [ERROR]   TestProlepticConversions.testSchemaEvolutionTimestamp:375 row 0 
==> expected: <-6212894324588> but was: <-6212894324412>
   [ERROR]   TestProlepticConversions.testSchemaEvolutionTimestamp:375 row 0 
==> expected: <-6212877044588> but was: <-6212877044412>
   ```
   




-- 
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: [email protected]

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


Reply via email to