DongLiang-0 commented on code in PR #419: URL: https://github.com/apache/doris-flink-connector/pull/419#discussion_r1671984142
########## flink-doris-connector/src/main/java/org/apache/doris/flink/serialization/RowBatch.java: ########## @@ -478,23 +486,38 @@ public boolean doConvert( return true; } + private Object handleMapFieldReader(FieldReader reader) { + if (reader instanceof TimeStampMicroReaderImpl) { + return longToLocalDateTime(reader.readLong()); + } + if (reader instanceof DateDayReaderImpl) { + return LocalDate.ofEpochDay(((Integer) reader.readObject()).longValue()); + } + return reader.readObject(); + } + @VisibleForTesting public LocalDateTime getDateTime(int rowIndex, FieldVector fieldVector) { TimeStampMicroVector vector = (TimeStampMicroVector) fieldVector; if (vector.isNull(rowIndex)) { return null; } long time = vector.get(rowIndex); + return longToLocalDateTime(time); + } + + @VisibleForTesting + public static LocalDateTime longToLocalDateTime(long time) { Review Comment: Is it possible to add a unit test for this method? ########## flink-doris-connector/src/main/java/org/apache/doris/flink/serialization/RowBatch.java: ########## @@ -478,23 +486,38 @@ public boolean doConvert( return true; } + private Object handleMapFieldReader(FieldReader reader) { + if (reader instanceof TimeStampMicroReaderImpl) { + return longToLocalDateTime(reader.readLong()); + } + if (reader instanceof DateDayReaderImpl) { + return LocalDate.ofEpochDay(((Integer) reader.readObject()).longValue()); + } + return reader.readObject(); + } + @VisibleForTesting public LocalDateTime getDateTime(int rowIndex, FieldVector fieldVector) { TimeStampMicroVector vector = (TimeStampMicroVector) fieldVector; if (vector.isNull(rowIndex)) { return null; } long time = vector.get(rowIndex); + return longToLocalDateTime(time); + } + + @VisibleForTesting + public static LocalDateTime longToLocalDateTime(long time) { Instant instant; - if (time / 10000000000L == 0) { // datetime(0) + // 判断时间戳精度并处理 Review Comment: Please use English comments -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org