wgtmac commented on code in PR #35139:
URL: https://github.com/apache/arrow/pull/35139#discussion_r1167966182
##########
java/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/utils/DateTimeUtils.java:
##########
@@ -47,7 +47,7 @@ public static long applyCalendarOffset(long milliseconds,
Calendar calendar) {
final TimeZone defaultTz = TimeZone.getDefault();
if (tz != defaultTz) {
- milliseconds -= tz.getOffset(milliseconds) -
defaultTz.getOffset(milliseconds);
+ milliseconds += tz.getOffset(milliseconds) -
defaultTz.getOffset(milliseconds);
Review Comment:
The problem is that I made this line of change in order to fix the test
failures of this case:
https://github.com/apache/arrow/blob/eaa1a1ea74e2b37020e0133f1460cb251e5f4974/java/flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/accessor/impl/calendar/ArrowFlightJdbcTimeStampVectorAccessorTest.java#L292
and let me paste the code snippet of that case below:
```java
@Test
public void
testShouldGetStringBeConsistentWithVarCharAccessorWithCalendar() throws
Exception {
// Ignore for TimeStamp vectors with TZ, as VarChar accessor won't
consider their TZ
Assume.assumeTrue(
vector instanceof TimeStampNanoVector || vector instanceof
TimeStampMicroVector ||
vector instanceof TimeStampMilliVector || vector instanceof
TimeStampSecVector);
Calendar calendar =
Calendar.getInstance(TimeZone.getTimeZone(AMERICA_VANCOUVER));
assertGetStringIsConsistentWithVarCharAccessor(calendar);
}
private void assertGetStringIsConsistentWithVarCharAccessor(Calendar
calendar) throws Exception {
try (VarCharVector varCharVector = new VarCharVector("",
rootAllocatorTestRule.getRootAllocator())) {
varCharVector.allocateNew(1);
ArrowFlightJdbcVarCharVectorAccessor varCharVectorAccessor =
new ArrowFlightJdbcVarCharVectorAccessor(varCharVector, () -> 0,
(boolean wasNull) -> {
});
accessorIterator.iterate(vector, (accessor, currentRow) -> {
final String string = accessor.getString();
varCharVector.set(0, new Text(string));
varCharVector.setValueCount(1);
Timestamp timestampFromVarChar =
varCharVectorAccessor.getTimestamp(calendar);
Timestamp timestamp = accessor.getTimestamp(calendar);
collector.checkThat(timestamp, is(timestampFromVarChar));
collector.checkThat(accessor.wasNull(), is(false));
});
}
}
```
--
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]