Gabriel39 commented on code in PR #71397:
URL: https://github.com/apache/doris/pull/71397#discussion_r4793564746
##########
be/src/core/value/vdatetime_value.h:
##########
@@ -1777,6 +1778,54 @@ inline uint32_t calc_daynr(uint16_t year, uint8_t month,
uint8_t day) {
return delsum + y / 4 - y / 100 + y / 400;
}
+// Doris follows MySQL's calendar, in which year 0 is NOT a leap year (see
`is_leap()`): 0000-02-29
+// does not exist and `calc_daynr()` therefore numbers 0000-01-01 ..
0000-02-28 one day ahead of the
+// proleptic Gregorian calendar. Arrow `date32`, Parquet/ORC `DATE` and the
Iceberg spec all define
+// their day ordinal in the proleptic Gregorian calendar, where year 0 IS a
leap year. The two
+// numberings coincide from 0000-03-01 (daynr 60) onwards, so the whole
difference is the missing
+// 0000-02-29. Every conversion between a Doris DATE and an external "days
since 1970-01-01" value
Review Comment:
Fixed in 0b1a2ea661. Public metadata rendering now uses the checked
Gregorian epoch-day helper and retains hexadecimal fallback for unrepresentable
bounds. Boundary/invalid-bound unit tests pass. The OUTFILE SQL suite now
exports a single 0000-02-28 value and verifies that parquet_meta reports
0000-02-28 for both bounds; its generated golden was then verified by a normal
comparison run.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]