jacktengg opened a new pull request, #70532: URL: https://github.com/apache/doris/pull/70532
### What problem does this PR solve? Issue Number: N/A Related PR: #69828 Backport of #69828 to `branch-4.2`, cherry-picked from `19dfb8711ae3dbb8f56cc945f5dc7af20a844607` with source attribution (`-x`). This branch is based directly on `apache/doris:branch-4.2` and is independent of the other backports. Calendar month, quarter, year and YEAR_MONTH arithmetic can clamp multiple dates to the same day while retaining their times, so treating it as globally monotonic can prune matching rows. Infer safe enclosing ranges for partition pruning, keep runtime-filter monotonicity checks separate, and align month/quarter/year difference constant folding with BE semantics. ### Branch-4.2 adaptations Resolved the PartitionPrunerTest import conflict by preserving the existing 4.2 imports and tests alongside the new calendar/range-inference tests. Retained the 4.2 evaluator and date-function context. ### Release note Fix missing rows caused by calendar arithmetic partition pruning and incorrect month, quarter and year difference constant folding. ### Validation - Checkstyle 9.3 with the repository configuration passed for all 17 changed Java files (run directly using cached Checkstyle dependencies). - Reviewed the backport against the merged source commit and verified the existing 4.2 tests remain intact. - Whitespace/conflict-marker checks passed (allowing the standard trailing blank line in regression `.out` files). - Exactly one backport commit on top of `7523405f6aa8e9df3d110eb432fed1ff6e1c3418`; clean worktree. - Full builds, unit tests and SQL regression suites were not run for this backport on this macOS host. The local environment lacks the required JDK 17/full Doris build dependencies; the offline Maven attempt could not resolve the required BOMs. Submodules remain uninitialized. FE unit tests and the calendar partition-pruning regression suite from the original PR are included. ### Check List (For Author) - Test: existing upstream unit/regression coverage included; local checks and execution limits are listed above. - Behavior changed: Yes; restores correct behavior as described above. - Does this need documentation: No. ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label -- 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]
