jacktengg opened a new pull request, #69271:
URL: https://github.com/apache/doris/pull/69271
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: Comparing a DATETIMEV2 column with a TIMESTAMP_NS literal
that has sub-microsecond precision can leave different physical operand types
after coercion. OLAP scan predicate normalization then reads the TIMESTAMP_NS
Field as DATETIMEV2 and fails instead of returning matching rows. Promote DATE,
DATEV2, DATETIME, DATETIMEV2 and TIMESTAMPTZ peers to TIMESTAMP_NS through the
existing strict casts. Apply the same rule to comparisons, IN, common temporal
result types and temporal functions. Preserve narrowing casts during comparison
simplification so overflow cannot be bypassed. Remove the literal-dependent
mixed-type fallbacks and heterogeneous temporal function signatures.
### Release note
Mixed TIMESTAMP_NS temporal expressions use TIMESTAMP_NS as their common
type. Conversions outside its signed Int64 epoch-nanosecond range raise errors
even when enable_strict_cast is false. Functions such as NULLIF also return the
common TIMESTAMP_NS type for mixed temporal inputs. Casting temporal columns
may reduce storage predicate pushdown.
### Check List (For Author)
- Test: Unit Test / Regression test / Manual test
- run-fe-ut.sh: 72 tests pass across TypeCoercionUtilsTest,
TimestampNsFunctionSignatureTest, SimplifyComparisonPredicateTest and
TimestampNsMonotonicityTest.
- build.sh --fe and FE Checkstyle pass.
- run-regression-test.sh: mixed_temporal_filter, mixed_datetime_coercion
and mixed_datetime_expressions pass; generate result files through the runner,
then verify them.
- Original three-row OLAP reproducer returns only id=1 and EXPLAIN
retains CAST(dt AS timestamp_ns). Local validation uses the existing worktree
ASAN BE with compatible be_exec_version=17.
- Behavior changed: Yes; mixed temporal coercion and overflow handling are
normalized as described in the release note.
- Does this need documentation: No; this corrects implicit coercion using
existing casts, with the compatibility changes recorded above.
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]