morrySnow opened a new pull request, #69833:
URL: https://github.com/apache/doris/pull/69833
### What problem does this PR solve?
TIMESTAMP_NS and TIMESTAMPTZ handling is scattered across signature search,
argument coercion, common-type casts and expression rewrites. Literal casts
also depend directly on executable SQL functions, while precision promotion
repeats concrete temporal-type lists.
This FE-only refactor gives those rules explicit ownership:
- Centralize temporal promotion and overload admission in
`TemporalTypeCoercion`, sharing literal exactness checks between signature
selection and argument coercion.
- Collect temporal CAST properties in `TemporalCastSupport`. Route
comparison, IN, CASE and set-operation common-type casts through shared entry
points while preserving strict range checks and nullable output layouts.
- Share timezone value conversion between literal casts and executable
functions through `TemporalValueConversion`, preserving rounding order and
existing DST behavior.
- Model adjustable temporal precision with `AdjustableScaleTimeType`; keep
TIMESTAMP_NS fixed at scale 9, replace nested precision in one traversal, and
remove unused indexed-ANY expression collection.
No SQL behavior change is intended. Explicit CAST legality remains in
`CheckCast`, and existing overload ordering, coercion compatibility modes and
diagnostics are preserved.
### Release note
None
### Check List (For Author)
- Test
- [x] Regression test
- [x] Unit Test
- [x] Manual test (details below)
Validation on master `8d88f1cc6f738a331ecfe024a2f1560c770068bb`:
- `./build.sh --fe` passed; Checkstyle passed with zero violations.
- `./run-fe-ut.sh` passed 192 focused tests, including five new tests for
nested precision, strict common-type casts, literal exactness, overload
selection and DST/invalid offsets.
- `./run-regression-test.sh` passed 7 of 9 temporal suites:
`test_timestamp_ns_cast`, `test_timestamp_ns_mixed_datetime_coercion`,
`test_cast_string_non_strict`, `test_timestamptz_cast`,
`test_timestamptz_coalesce`, `test_timestamptz_dst_fold`, and
`test_timestamptz_dst_gap`.
- Two suites failed and were reproduced identically using an unmodified FE
built from the same master against the same existing BE:
`test_timestamptz_historical_offset` omits seconds from a historical offset
suffix, and `test_cast_timestamptz` returns NULL for extended/historical offset
strings. The existing BE is `04d76fba592`, and the test FE uses execution
version 14 for compatibility. These failures are not introduced by this
refactor.
- Restored the refactored FE after the baseline comparison and verified
TIMESTAMP_NS literal and TIMESTAMPTZ-to-DATETIMEV2 smoke queries.
- Behavior changed:
- [x] No.
- [ ] Yes.
- Does this need documentation?
- [x] No.
- [ ] Yes.
### 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]