cloud-fan commented on a change in pull request #27807: [SPARK-31076][SQL] 
Convert Catalyst's DATE/TIMESTAMP to Java Date/Timestamp via local date-time
URL: https://github.com/apache/spark/pull/27807#discussion_r390732047
 
 

 ##########
 File path: 
sql/core/v2.3/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcColumnVector.java
 ##########
 @@ -136,7 +138,9 @@ public int getInt(int rowId) {
   public long getLong(int rowId) {
     int index = getRowIndex(rowId);
     if (isTimestamp) {
-      return timestampData.time[index] * 1000 + timestampData.nanos[index] / 
1000 % 1000;
+      Timestamp ts = new Timestamp(timestampData.time[index]);
+      ts.setNanos(timestampData.nanos[index]);
+      return DateTimeUtils.fromJavaTimestamp(ts);
 
 Review comment:
   Under the hood, this re-uses the `Timestamp` object and should be more 
efficient.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to