Search before asking
Motivation
PojoDataFileMeta.creationTimeEpochMillis() handling logic:
- Converts the timestamp to LocalDateTime using
toLocalDateTime() (which ignores timezone information)
- Then treats this LocalDateTime as if it were in the system default timezone
- Finally converts it back to epoch milliseconds
This double conversion causes timezone-related errors, especially when the system default timezone is not UTC.
@Override
public long creationTimeEpochMillis() {
return creationTime
.toLocalDateTime()
.atZone(ZoneId.systemDefault())
.toInstant()
.toEpochMilli();
}
According to the Javadoc of the Timestamp class, the millisecond field already stores the number of milliseconds since the epoch (1970-01-01 00:00:00 UTC).
So millisecond in creationTime is UTC will be converted to Asia/Shanghai timezone millisecond,
which will 8h shift to the left.
This approach can be confusing for user (apache/amoro#4066). I'm wondering if we should simply use the milliseconds directly like this:
@Override
public long creationTimeEpochMillis() {
return creationTime.getTime();
}
Please let me know if I'm understanding this correctly or if there are any issues with this approach.
Solution
No response
Anything else?
No response
Are you willing to submit a PR?
Search before asking
Motivation
PojoDataFileMeta.creationTimeEpochMillis()handling logic:toLocalDateTime()(which ignores timezone information)This double conversion causes timezone-related errors, especially when the system default timezone is not UTC.
According to the Javadoc of the
Timestampclass, the millisecond field already stores the number of milliseconds since the epoch (1970-01-01 00:00:00 UTC).So
millisecondincreationTimeis UTC will be converted toAsia/Shanghaitimezone millisecond,which will 8h shift to the left.
This approach can be confusing for user (apache/amoro#4066). I'm wondering if we should simply use the milliseconds directly like this:
Please let me know if I'm understanding this correctly or if there are any issues with this approach.
Solution
No response
Anything else?
No response
Are you willing to submit a PR?