branch-4.0: [fix](fe) Handle generated columns in delete partial update#65067
Open
bobhan1 wants to merge 1 commit into
Open
branch-4.0: [fix](fe) Handle generated columns in delete partial update#65067bobhan1 wants to merge 1 commit into
bobhan1 wants to merge 1 commit into
Conversation
…4884) Issue Number: N/A Related PR: N/A Original Problem: DELETE failed during analysis on a unique merge-on-write table that contains a generated column when light delete is disabled. The original reported table had a generated VARIANT column: ```sql new_col variant AS (receive_address_detail) NULL ``` and the DELETE failed with: ```text errCode = 2, detailMessage = cannot find column from target table /receive_address_detail ``` A minimized reproduction is: ```sql create table test_gen_col_mow_delete_partial_update ( a int, b int, c int as (b + 1), d int ) unique key(a) distributed by hash(a) buckets 1 properties ( "enable_unique_key_merge_on_write" = "true", "enable_mow_light_delete" = "false", "replication_num" = "1" ); ``` After inserting rows, running: ```sql delete from test_gen_col_mow_delete_partial_update where a = 1; ``` failed with: ```text java.sql.SQLException: errCode = 2, detailMessage = cannot find column from target table [b] ``` Problem Summary: DELETE on a unique merge-on-write table with light delete disabled is rewritten to a partial update load that writes key columns and the delete sign. BindSink used to auto-add every generated column and then recompute omitted generated columns, which required ordinary value columns that were not part of the DELETE output and caused analysis to fail. This change treats DELETE partial updates specially: generated columns that are not emitted by the child plan are skipped, and generated columns that are emitted by the child plan use that child output directly. Normal partial update generated-column dependency checks are unchanged. The tests cover generated value columns, generated key columns, a generated value-column table with an omitted NOT NULL value column that has no default value, and the original VARIANT generated-column shape based on `receive_address_detail`. Fix DELETE failure on unique merge-on-write tables with generated columns when light delete is disabled. - Test: Regression test / Unit Test - `./build.sh --fe -j100` - `./run-fe-ut.sh --run org.apache.doris.nereids.trees.plans.DeleteFromUsingCommandTest` - `./run-regression-test.sh --run -d regression-test/suites/ddl_p0/test_create_table_generated_column -s test_generated_column_delete -forceGenOut` - `./run-regression-test.sh --run -d regression-test/suites/ddl_p0/test_create_table_generated_column -s test_generated_column_delete` - `./run-regression-test.sh --run -d regression-test/suites/ddl_p0/test_create_table_generated_column -s test_partial_update_generated_column` - Behavior changed: Yes (DELETE now succeeds for unique merge-on-write tables with generated columns when light delete is disabled.) - Does this need documentation: No (cherry picked from commit c02808a)
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
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?
Issue Number: N/A
Related PR: #64884
Problem Summary:
This PR backports #64884 to branch-4.0.
For DELETE on unique merge-on-write tables with generated columns and
enable_mow_light_delete=false, Doris rewrites DELETE into a partial update.Before the fix,
BindSinkstill treated generated columns as target columns tobind and recompute. If the generated-column expression referenced ordinary
columns that were not part of the DELETE partial-update output, analysis could
fail before the DELETE was planned.
This change detects the DELETE partial-update path in
BindSink, avoidsauto-adding omitted generated columns for that path, and keeps existing
generated-column handling for normal INSERT/UPDATE partial updates.
Release note
None
Check List (For Author)
Regression test:
Unit test:
Manual test:
The local regression cluster was restarted after rebuilding BE. FE and BE both
reported version
doris-4.0.6-rc02-a9d12207ae5before running regression.Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)