Copilot commented on code in PR #6761:
URL: https://github.com/apache/hive/pull/6761#discussion_r4017450548


##########
ql/src/java/org/apache/hadoop/hive/ql/io/orc/RecordReaderImpl.java:
##########
@@ -466,6 +469,28 @@ static TimestampWritableV2 nextTimestamp(ColumnVector 
vector,
     }
   }
 
+  static TimestampLocalTZWritable nextTimestampLocalTZ(ColumnVector vector,
+                                                        int row,
+                                                        Object previous) {
+    if (vector.isRepeating) {
+      row = 0;
+    }
+    if (vector.noNulls || !vector.isNull[row]) {
+      TimestampLocalTZWritable result;
+      if (previous == null || previous.getClass() != 
TimestampLocalTZWritable.class) {
+        result = new TimestampLocalTZWritable();
+      } else {
+        result = (TimestampLocalTZWritable) previous;
+      }
+      TimestampColumnVector tcv = (TimestampColumnVector) vector;
+      long epochSecond = Math.floorDiv(tcv.time[row], 1000L);
+      result.set(new TimestampTZ(epochSecond, tcv.nanos[row], 
ZoneId.systemDefault()));

Review Comment:
   This hard-codes the JVM default zone, but Hive's `TIMESTAMP WITH LOCAL TIME 
ZONE` display zone is the session's `hive.local.time.zone`. The reader is 
already constructed with the job `Configuration`, and `SET TIME ZONE` can 
change that value without changing `ZoneId.systemDefault()`, so reading an ORC 
table after a session-zone change can return the correct instant rendered in 
the wrong local time. Thread the configured zone (with a system-default 
fallback when `conf` is null) into this helper and add a round-trip assertion 
across two session zones.



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


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

Reply via email to