Mryange opened a new pull request, #70275: URL: https://github.com/apache/doris/pull/70275
### Background TIMESTAMPTZ floor/ceil functions round timestamps into buckets anchored at an origin. FE constant folding must use the same session-timezone and DST rules as BE execution. ### What problem does this PR solve? Issue Number: None Related PR: None PR Type: Bugfix Problem Summary: TIMESTAMPTZ floor/ceil can return different buckets depending on whether FE folds the expression. For example, a two-hour bucket across New York's spring DST transition becomes 03:00 instead of 04:00, and a summer month bucket anchored in winter becomes 01:00 instead of midnight. Convert each timestamp using its own timezone offset and match BE's overlap, gap, and second-rounding policies. ### Details - **Change map:** 46 changed lines in one FE helper, 197 lines of unit/regression tests, and 517 lines of generated regression output. No BE or documentation changes. - **Frequency:** Inputs and origins separated by timezone offset transitions, repeated/skipped local times, or second periods with the implicit origin. - **Root cause:** FE applied the input's fixed offset to the origin and used Java's default local-time resolution; second rounding also used local time while BE uses UTC. - **Why existing tests missed it:** They did not compare FE folding with BE execution across DST using origins with a different offset. - **Fix:** Convert explicit origins independently, reuse the existing cctz-compatible gap resolver, preserve the input offset for repeated hours/minutes, and round seconds in UTC. - **Other paths and branches:** DATETIME and TIMESTAMP_NS paths are unchanged; BE already implements these policies. Release-branch pick compatibility is checked independently. - **Behavior change:** Affected folded TIMESTAMPTZ expressions now produce the same instants as BE execution. ### Testing - Local FE build and Checkstyle passed: `build.sh --fe -j48`. - `TimeRoundSeriesTimestampTzTest`: 4 tests passed. - `test_timestamptz_round_dst`: generated output with `-forceGenOut`, inspected all 67 sections, and passed a normal rerun. All 21 timezone/unit groups agree across FE folding, BE constant execution, and real columns; default-origin controls agree as well. - Existing `test_timestamptz_dst_fold` passed. - Validation used FE built from 040cdca6fcb plus this patch and the existing BE bdb90856e6e; the relevant BE rounding/timezone logic is unchanged at the updated master base. The subsequent base update did not change the affected FE code. ### Release note Fix incorrect TIMESTAMPTZ floor/ceil constant-folding results across timezone transitions and align second buckets with BE execution. ### Check List (For Author) - Behavior changed: Yes (see Details). - Does this need documentation: No. - Pre-submission status: Ready. ### AI Disclosure - Tool: Codex (GPT-6). - Generated: Code, tests, and PR description. - Human review: Pending author review of the final diff. -- 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]
