You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/12/05 04:27:46 UTC
[GitHub] [flink] JingsongLi commented on a change in pull request #10426:
[FLINK-15062][orc] Orc reader should use java.sql.Timestamp to read for
respecting time zone
JingsongLi commented on a change in pull request #10426: [FLINK-15062][orc] Orc reader should use java.sql.Timestamp to read for respecting time zone
URL: https://github.com/apache/flink/pull/10426#discussion_r354106338
##########
File path: flink-formats/flink-orc/src/main/java/org/apache/flink/orc/vector/AbstractOrcColumnVector.java
##########
@@ -176,20 +176,15 @@ private static DoubleColumnVector createDoubleVector(int batchSize, Object value
return dcv;
}
- private static TimestampColumnVector createTimestampVector(int batchSize, LocalDateTime value) {
+ private static TimestampColumnVector createTimestampVector(int batchSize, Object value) {
TimestampColumnVector lcv = new TimestampColumnVector(batchSize);
if (value == null) {
lcv.noNulls = false;
lcv.isNull[0] = true;
lcv.isRepeating = true;
} else {
- long epochDay = value.toLocalDate().toEpochDay();
- long nanoOfDay = value.toLocalTime().toNanoOfDay();
-
- long millisecond = epochDay * 24 * 60 * 60 * 1000 + nanoOfDay / 1_000_000;
- int nanoOfSecond = (int) (nanoOfDay % 1_000_000_000);
- Timestamp timestamp = new Timestamp(millisecond);
- timestamp.setNanos(nanoOfSecond);
+ Timestamp timestamp = value instanceof LocalDateTime ?
+ Timestamp.valueOf((LocalDateTime) value) : (Timestamp) value;
Review comment:
`java.sql.Timestamp` is the default format in hive world, but `LocalDateTime` is the default format in flink world.
Whatever, It must be correct that support all.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services