darkamgine commented on a change in pull request #631:
URL: https://github.com/apache/orc/pull/631#discussion_r559554201
##########
File path: java/tools/src/java/org/apache/orc/tools/convert/CsvReader.java
##########
@@ -252,16 +268,20 @@ public void convert(String[] values, ColumnVector column,
int row) {
TimestampColumnVector vector = (TimestampColumnVector) column;
TemporalAccessor temporalAccessor =
dateTimeFormatter.parseBest(values[offset],
- ZonedDateTime.FROM, LocalDateTime.FROM);
+ ZonedDateTime::from, OffsetDateTime::from,
LocalDateTime::from);
if (temporalAccessor instanceof ZonedDateTime) {
ZonedDateTime zonedDateTime = ((ZonedDateTime) temporalAccessor);
- Timestamp timestamp = new Timestamp(zonedDateTime.toEpochSecond() *
1000L);
- timestamp.setNanos(zonedDateTime.getNano());
+ Timestamp timestamp = Timestamp.from(zonedDateTime.toInstant());
vector.set(row, timestamp);
- } else if (temporalAccessor instanceof LocalDateTime) {
+ }
+ else if (temporalAccessor instanceof OffsetDateTime) {
+ OffsetDateTime offsetDateTime = (OffsetDateTime) temporalAccessor;
+ Timestamp timestamp = Timestamp.from(offsetDateTime.toInstant());
+ vector.set(row, timestamp);
+ }
+ else if (temporalAccessor instanceof LocalDateTime) {
Review comment:
updated
----------------------------------------------------------------
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:
[email protected]