|
31 | 31 | import java.time.ZonedDateTime; |
32 | 32 | import java.time.temporal.ChronoUnit; |
33 | 33 | import java.util.Calendar; |
| 34 | +import java.util.Objects; |
34 | 35 | import java.util.TimeZone; |
35 | 36 | import java.util.concurrent.TimeUnit; |
36 | 37 | import java.util.function.IntSupplier; |
@@ -71,7 +72,9 @@ public ArrowFlightJdbcTimeStampVectorAccessor( |
71 | 72 | this.holder = new Holder(); |
72 | 73 | this.getter = createGetter(vector); |
73 | 74 |
|
| 75 | + // whether the vector included TZ info |
74 | 76 | this.isZoned = getVectorIsZoned(vector); |
| 77 | + // non-null, either the vector TZ or default to UTC |
75 | 78 | this.timeZone = getTimeZoneForVector(vector); |
76 | 79 | this.timeUnit = getTimeUnitForVector(vector); |
77 | 80 | this.longToLocalDateTime = getLongToLocalDateTimeForVector(vector, this.timeZone); |
@@ -231,11 +234,7 @@ protected static TimeZone getTimeZoneForVector(TimeStampVector vector) { |
231 | 234 | ArrowType.Timestamp arrowType = |
232 | 235 | (ArrowType.Timestamp) vector.getField().getFieldType().getType(); |
233 | 236 |
|
234 | | - String timezoneName = arrowType.getTimezone(); |
235 | | - if (timezoneName == null) { |
236 | | - return TimeZone.getTimeZone("UTC"); |
237 | | - } |
238 | | - |
| 237 | + String timezoneName = Objects.requireNonNullElse(arrowType.getTimezone(), "UTC"); |
239 | 238 | return TimeZone.getTimeZone(timezoneName); |
240 | 239 | } |
241 | 240 |
|
|
0 commit comments