Support flexible partial update for routine load#60128
Conversation
This feature adds support for UPDATE_FLEXIBLE_COLUMNS mode in routine load, allowing partial updates where the columns to update are determined dynamically from each JSON row's fields rather than being fixed upfront. Key changes: - Add unique_key_update_mode property to routine load (UPSERT, UPDATE_FIXED_COLUMNS, UPDATE_FLEXIBLE_COLUMNS) - Validate flexible partial update constraints (JSON format only, no jsonpaths, no COLUMNS clause, no fuzzy_parse) - Support ALTER ROUTINE LOAD to change update mode - Add comprehensive regression tests for all scenarios - Add waitForTaskFinishMoW utility for MOW table tests Constraints for flexible partial update: - Only JSON format supported - Cannot use jsonpaths (columns determined from JSON fields) - Cannot use COLUMNS clause - Cannot use fuzzy_parse - Table must be MOW with skip_bitmap column enabled - Table cannot have variant columns
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
There was a problem hiding this comment.
Pull request overview
This PR adds support for flexible partial update mode (UPDATE_FLEXIBLE_COLUMNS) in routine load operations for Apache Doris. The feature enables partial updates where the columns to update are determined dynamically from each JSON row's fields, rather than being fixed upfront.
Changes:
- Introduced
unique_key_update_modeproperty supporting UPSERT, UPDATE_FIXED_COLUMNS, and UPDATE_FLEXIBLE_COLUMNS modes - Added validation constraints for flexible partial updates (JSON format only, MOW tables with skip_bitmap column, no jsonpaths/fuzzy_parse/COLUMNS clause)
- Implemented ALTER ROUTINE LOAD support to change update modes
- Added comprehensive regression tests covering all scenarios and edge cases
- Introduced
waitForTaskFinishMoWutility for testing MOW table operations
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test_routine_load_partial_update_new_key_behavior.groovy | Updated error message to be more general (partial update vs partial_columns) |
| test_routine_load_flexible_partial_update.groovy | New comprehensive test suite with 21 test cases covering feature functionality and validation |
| test_routine_load_flexible_partial_update.out | Expected test output file for the new test suite |
| RoutineLoadTestUtils.groovy | Added waitForTaskFinishMoW method for MOW table testing with skip_delete_bitmap support |
| CreateRoutineLoadInfo.java | Added parsing, validation logic, and flexible partial update constraints |
| AlterRoutineLoadCommand.java | Added unique_key_update_mode to alterable properties |
| NereidsStreamLoadPlanner.java | Refactored validation to use centralized OlapTable.validateForFlexiblePartialUpdate |
| NereidsRoutineLoadTaskInfo.java | Updated constructor to accept uniqueKeyUpdateMode parameter |
| RoutineLoadJob.java | Added update mode tracking, backward compatibility, and ALTER validation logic |
| KafkaRoutineLoadJob.java | Updated to pass uniqueKeyUpdateMode to task info |
| OlapTable.java | Added centralized validateForFlexiblePartialUpdate method |
| RoutineLoadJobTest.java | Added comprehensive unit tests for parsing and validation logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| throw new UserException("Flexible partial update can only support table with skip bitmap hidden column." | ||
| + " But table " + getName() + " doesn't have it. You can use `ALTER TABLE " + getName() | ||
| + " ENABLE FEATURE \"UPDATE_FLEXIBLE_COLUMNS\";` to add it to the table."); | ||
| } | ||
| if (!getEnableLightSchemaChange()) { | ||
| throw new UserException("Flexible partial update can only support table with light_schema_change enabled." | ||
| + " But table " + getName() + "'s property light_schema_change is false"); | ||
| } | ||
| if (hasVariantColumns()) { | ||
| throw new UserException("Flexible partial update can only support table without variant columns."); |
There was a problem hiding this comment.
The error message text has an inconsistency with the grammar. The message says "can only support table" but should say "only supports tables" (plural) for better grammar, or "can only support a table" (singular with article) for grammatical correctness.
| throw new UserException("Flexible partial update can only support table with skip bitmap hidden column." | |
| + " But table " + getName() + " doesn't have it. You can use `ALTER TABLE " + getName() | |
| + " ENABLE FEATURE \"UPDATE_FLEXIBLE_COLUMNS\";` to add it to the table."); | |
| } | |
| if (!getEnableLightSchemaChange()) { | |
| throw new UserException("Flexible partial update can only support table with light_schema_change enabled." | |
| + " But table " + getName() + "'s property light_schema_change is false"); | |
| } | |
| if (hasVariantColumns()) { | |
| throw new UserException("Flexible partial update can only support table without variant columns."); | |
| throw new UserException("Flexible partial update only supports tables with a skip bitmap hidden column." | |
| + " But table " + getName() + " doesn't have it. You can use `ALTER TABLE " + getName() | |
| + " ENABLE FEATURE \"UPDATE_FLEXIBLE_COLUMNS\";` to add it to the table."); | |
| } | |
| if (!getEnableLightSchemaChange()) { | |
| throw new UserException("Flexible partial update only supports tables with light_schema_change enabled." | |
| + " But table " + getName() + "'s property light_schema_change is false"); | |
| } | |
| if (hasVariantColumns()) { | |
| throw new UserException("Flexible partial update only supports tables without variant columns."); |
| throw new UserException("Flexible partial update can only support table with skip bitmap hidden column." | ||
| + " But table " + getName() + " doesn't have it. You can use `ALTER TABLE " + getName() | ||
| + " ENABLE FEATURE \"UPDATE_FLEXIBLE_COLUMNS\";` to add it to the table."); | ||
| } | ||
| if (!getEnableLightSchemaChange()) { | ||
| throw new UserException("Flexible partial update can only support table with light_schema_change enabled." | ||
| + " But table " + getName() + "'s property light_schema_change is false"); | ||
| } | ||
| if (hasVariantColumns()) { | ||
| throw new UserException("Flexible partial update can only support table without variant columns."); |
There was a problem hiding this comment.
The error message text has an inconsistency with the grammar. The message says "can only support table" but should say "only supports tables" (plural) for better grammar, or "can only support a table" (singular with article) for grammatical correctness.
| throw new UserException("Flexible partial update can only support table with skip bitmap hidden column." | |
| + " But table " + getName() + " doesn't have it. You can use `ALTER TABLE " + getName() | |
| + " ENABLE FEATURE \"UPDATE_FLEXIBLE_COLUMNS\";` to add it to the table."); | |
| } | |
| if (!getEnableLightSchemaChange()) { | |
| throw new UserException("Flexible partial update can only support table with light_schema_change enabled." | |
| + " But table " + getName() + "'s property light_schema_change is false"); | |
| } | |
| if (hasVariantColumns()) { | |
| throw new UserException("Flexible partial update can only support table without variant columns."); | |
| throw new UserException("Flexible partial update only supports tables with a skip bitmap hidden column." | |
| + " But table " + getName() + " doesn't have it. You can use `ALTER TABLE " + getName() | |
| + " ENABLE FEATURE \"UPDATE_FLEXIBLE_COLUMNS\";` to add it to the table."); | |
| } | |
| if (!getEnableLightSchemaChange()) { | |
| throw new UserException("Flexible partial update only supports tables with light_schema_change enabled." | |
| + " But table " + getName() + "'s property light_schema_change is false"); | |
| } | |
| if (hasVariantColumns()) { | |
| throw new UserException("Flexible partial update only supports tables without variant columns."); |
| "property.kafka_default_offsets" = "OFFSET_BEGINNING" | ||
| ); | ||
| """ | ||
| exception "Flexible partial update can only support table with skip bitmap hidden column" |
There was a problem hiding this comment.
The error message text has an inconsistency with the grammar. The message says "can only support table" but should say "only supports tables" (plural) for better grammar, or "can only support a table" (singular with article) for grammatical correctness.
| exception "Flexible partial update can only support table with skip bitmap hidden column" | |
| exception "Flexible partial update only supports tables with skip bitmap hidden column" |
| "property.kafka_default_offsets" = "OFFSET_BEGINNING" | ||
| ); | ||
| """ | ||
| exception "Flexible partial update can only support table without variant columns" |
There was a problem hiding this comment.
The error message text has an inconsistency with the grammar. The message says "can only support table" but should say "only supports tables" (plural) for better grammar, or "can only support a table" (singular with article) for grammatical correctness.
| exception "Flexible partial update can only support table without variant columns" | |
| exception "Flexible partial update only supports tables without variant columns" |
| "unique_key_update_mode" = "UPDATE_FLEXIBLE_COLUMNS" | ||
| ); | ||
| """ | ||
| exception "Flexible partial update can only support table with skip bitmap hidden column" |
There was a problem hiding this comment.
The error message text has an inconsistency with the grammar. The message says "can only support table" but should say "only supports tables" (plural) for better grammar, or "can only support a table" (singular with article) for grammatical correctness.
| exception "Flexible partial update can only support table with skip bitmap hidden column" | |
| exception "Flexible partial update can only support a table with skip bitmap hidden column" |
| throw new UserException("Flexible partial update can only support table with skip bitmap hidden column." | ||
| + " But table " + getName() + " doesn't have it. You can use `ALTER TABLE " + getName() | ||
| + " ENABLE FEATURE \"UPDATE_FLEXIBLE_COLUMNS\";` to add it to the table."); | ||
| } | ||
| if (!getEnableLightSchemaChange()) { | ||
| throw new UserException("Flexible partial update can only support table with light_schema_change enabled." | ||
| + " But table " + getName() + "'s property light_schema_change is false"); | ||
| } | ||
| if (hasVariantColumns()) { | ||
| throw new UserException("Flexible partial update can only support table without variant columns."); |
There was a problem hiding this comment.
The error message text has an inconsistency with the grammar. The message says "can only support table" but should say "only supports tables" (plural) for better grammar, or "can only support a table" (singular with article) for grammatical correctness.
| throw new UserException("Flexible partial update can only support table with skip bitmap hidden column." | |
| + " But table " + getName() + " doesn't have it. You can use `ALTER TABLE " + getName() | |
| + " ENABLE FEATURE \"UPDATE_FLEXIBLE_COLUMNS\";` to add it to the table."); | |
| } | |
| if (!getEnableLightSchemaChange()) { | |
| throw new UserException("Flexible partial update can only support table with light_schema_change enabled." | |
| + " But table " + getName() + "'s property light_schema_change is false"); | |
| } | |
| if (hasVariantColumns()) { | |
| throw new UserException("Flexible partial update can only support table without variant columns."); | |
| throw new UserException("Flexible partial update is only supported for tables with a skip bitmap hidden column." | |
| + " But table " + getName() + " doesn't have it. You can use `ALTER TABLE " + getName() | |
| + " ENABLE FEATURE \"UPDATE_FLEXIBLE_COLUMNS\";` to add it to the table."); | |
| } | |
| if (!getEnableLightSchemaChange()) { | |
| throw new UserException("Flexible partial update is only supported for tables with light_schema_change enabled." | |
| + " But table " + getName() + "'s property light_schema_change is false"); | |
| } | |
| if (hasVariantColumns()) { | |
| throw new UserException("Flexible partial update is only supported for tables without variant columns."); |
FE UT Coverage ReportIncrement line coverage |
pick #59896
This feature adds support for UPDATE_FLEXIBLE_COLUMNS mode in routine load, allowing partial updates where the columns to update are determined dynamically from each JSON row's fields rather than being fixed upfront.
Key changes:
Constraints for flexible partial update:
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)