[fix](load) Preserve declared types in generated column dependencies - #67758
Open
feiniaofeiafei wants to merge 2 commits into
Open
[fix](load) Preserve declared types in generated column dependencies#67758feiniaofeiafei wants to merge 2 commits into
feiniaofeiafei wants to merge 2 commits into
Conversation
feiniaofeiafei
requested review from
924060929,
englefly,
morrySnow and
starocean999
as code owners
September 10, 2026 03:28
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
morrySnow
approved these changes
Sep 10, 2026
Contributor
|
run buildall |
### What problem does this PR solve?
Problem Summary: Generated column expressions are substituted into dependent
columns before conversion to their declared types. For c BOOLEAN AS (a) and
d INT AS (c + 1), inserting a=2 stores c=1 but d=3. Cast each generated
expression before registering it for dependent columns so d uses the stored
value of c. Cover boolean and numeric chains, nulls, and insert paths.
### Release note
Fix incorrect values in generated columns that reference generated columns
with a different expression type from their declared type.
### Check List (For Author)
- Test: Manual test reproduced the incorrect result on the existing FE;
regression tests added, execution pending remote FE build.
- Behavior changed: Yes, dependent generated columns use declared-type values.
- Does this need documentation: No
### What problem does this PR solve?
Problem Summary: Add generated expected results for declared-type dependency
chains and cover numeric chains through Stream Load using existing input data.
The tests compare generated values with expressions evaluated from stored
columns, including nulls, positive and negative values, INSERT VALUES,
INSERT SELECT, and INSERT OVERWRITE.
### Release note
None
### Check List (For Author)
- Test: Regression test - test_generated_column_declared_type,
test_generated_column, and test_generated_column_update all passed on dev.
Expected output generated by run-regression-test.sh. FE build and
Checkstyle passed with DISABLE_BUILD_UI=ON; be_exec_version=13 matched BE.
Manual test verified both reported examples on pre-existing tables.
- Behavior changed: No
- Does this need documentation: No
feiniaofeiafei
force-pushed
the
codex/fix-generated-column-declared-type
branch
from
September 11, 2026 02:40
220b9f4 to
536679d
Compare
Collaborator
Author
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
TPC-H: Total hot run time: 16866 ms |
Contributor
TPC-DS: Total hot run time: 81493 ms |
Contributor
ClickBench: Total hot run time: 14.72 s |
Collaborator
Author
|
run cloud_p0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Related PR:#35284
Problem Summary:
Generated columns are substituted into dependent expressions before conversion to their declared types. For
c BOOLEAN AS (a)andd INT AS (c + 1), insertinga = 2storesc = truebutd = 3, while evaluatingc + 1from the stored column returns2. Similarly,x = 1.7,c INT AS (x), andd DOUBLE AS (c + 0.25)incorrectly stored = 1.95instead of1.25.Cast each generated expression to its declared column type before registering it for substitution into dependent generated columns in
BindSink. This also applies to new writes into existing tables; previously stored incorrect values are not recalculated.Release note
Fix incorrect generated column values when a generated column references another generated column whose expression type differs from its declared type.
Check List (For Author)
Test
test_generated_column_declared_type,test_generated_column, andtest_generated_column_update.run-regression-test.shand verified in a subsequent run.DISABLE_BUILD_UI=ON ./build.sh --fe; the test FE usedbe_exec_version=13to match the existing BE.Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)