Repository navigation
Commit 688e8d5
[fix](fe) Reject a DEFAULT(column) whose writer type differs from its read type
### What problem does this PR solve?
Issue Number: None
Related PR: #66538
Problem Summary: Review follow-up. The previous commits typed the default
that replaces a bound DEFAULT(column) as its pinned writer column. That type
differs from the read column's only when the table changed outside Doris
after Doris cached its read schema, e.g. an INT column promoted to BIGINT
whose new write-default is 4900000001. The expressions around
DEFAULT(column) were already bound against the read type and the rewriter
keeps their signatures, so in
UPDATE t SET ... WHERE IF(TRUE, DEFAULT(score), 0) = 4900000001
the IF keeps its INT result type and constant folding casts 4900000001 back
to INT: NULL in non-strict mode, so no row matches, and an overflow error in
strict mode. A substituted value cannot repair the types its consumers were
bound with, so the rewrite now fails such a DEFAULT and asks to refresh the
table. When the two types agree, which is every case without a type change
made outside Doris, nothing changes.
### Release note
None
### Check List (For Author)
- Test: Unit Test
- RewriteDefaultExpressionTest: a DEFAULT whose writer type differs is rejected, directly and under an IF bound to the read type
- ConnectorWriteSchemaUtilsTest, InsertUtilsTest, ExternalRowLevelUpdatePlanBuilderTest, ExternalRowLevelMergePlanBuilderTest, ChangelogRowLevelDmlTransformTest, PluginDrivenExternalTableTest
- Behavior changed: No
- Does this need documentation: No
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>1 parent f1287fd commit 688e8d5
2 files changed
Lines changed: 33 additions & 10 deletions
File tree
- fe/fe-core/src
- main/java/org/apache/doris/nereids/rules/expression/rules
- test/java/org/apache/doris/nereids/rules/expression/rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
96 | 106 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 107 | | |
101 | 108 | | |
102 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | | - | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | | - | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | | - | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
77 | 93 | | |
78 | 94 | | |
79 | 95 | | |
| |||
0 commit comments