wgtmac opened a new pull request, #35139:
URL: https://github.com/apache/arrow/pull/35139

   ### Rationale for this change
   
   The piece of code below in the `class 
ArrowFlightJdbcTimeStampVectorAccessor` does not deal with timezone correctly.
   
   ```java
     private LocalDateTime getLocalDateTime(Calendar calendar) {
       getter.get(getCurrentRow(), holder);
       this.wasNull = holder.isSet == 0;
       this.wasNullConsumer.setWasNull(this.wasNull);
       if (this.wasNull) {
         return null;
       }
   
       long value = holder.value;
   
       LocalDateTime localDateTime = this.longToLocalDateTime.fromLong(value);
   
       if (calendar != null) {
         TimeZone timeZone = calendar.getTimeZone();
         long millis = this.timeUnit.toMillis(value);
         localDateTime = localDateTime
             .minus(timeZone.getOffset(millis) - 
this.timeZone.getOffset(millis), ChronoUnit.MILLIS);
       }
       return localDateTime;
     }
   ```
   
   I hit this issue when integrating this into our own JDBC implementation and 
found that the timestamp string in the `ResultSet` is wrong when converting 
between timezones.
   
   ### What changes are included in this PR?
   
   It should call `localDateTime.plus` instead of `localDateTime.minus`.
   
   ### Are these changes tested?
   
   Actually these conversions are covered by plenty of tests but unfortunately 
they share the same issues. This comment fixes them all.
   
   ### Are there any user-facing changes?
   
   No.


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