You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/06/26 21:47:43 UTC
[GitHub] [iceberg] rdblue commented on a change in pull request #1127: ORC: fix date metrics to adjust milliseconds to local timezone
rdblue commented on a change in pull request #1127:
URL: https://github.com/apache/iceberg/pull/1127#discussion_r446425293
##########
File path: orc/src/main/java/org/apache/iceberg/orc/OrcMetrics.java
##########
@@ -158,8 +158,7 @@ private static Metrics buildOrcMetrics(final long numOfRows, final TypeDescripti
.orElse(null);
} else if (columnStats instanceof DateColumnStatistics) {
min = Optional.ofNullable(((DateColumnStatistics) columnStats).getMinimum())
- .map(minStats -> DateTimeUtil.daysFromDate(
- DateTimeUtil.EPOCH.plus(minStats.getTime(), ChronoUnit.MILLIS).toLocalDate()))
+ .map(minStats -> DateTimeUtil.daysFromDate(((Date) minStats).toLocalDate()))
Review comment:
Javadoc for `Date.toLocalDate` says that the LocalDate returned is "in local time zone". It is implemented like this:
```java
return LocalDate.of(getYear() + 1900, getMonth() + 1, getDate());
```
And, those getter methods use the current zone. So this cannot be correct because the value is dependent on the local zone. I think your intent was to account for the adjustment made by ORC that you referenced by saying "Getting the min/max stats for Date types in ORC are returned with milliseconds adjusted to the local timezone."
I think the main problem is that this uses a path where the value is modified by ORC based on the JVM environment, which breaks a fundamental rule in Iceberg. I don't think that we should use a path where the value is modified.
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org