Skip to content

[feature](fe) Add routine load target-table alter support#64878

Draft
0AyanamiRei wants to merge 2 commits into
apache:masterfrom
0AyanamiRei:feature/routine-load-target-table-switch
Draft

[feature](fe) Add routine load target-table alter support#64878
0AyanamiRei wants to merge 2 commits into
apache:masterfrom
0AyanamiRei:feature/routine-load-target-table-switch

Conversation

@0AyanamiRei

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary: Add support for ALTER ROUTINE LOAD FOR [db.]job ON table so a paused single-table Kafka routine load job can switch its target table within the same database. The new table is revalidated against load properties, progress is preserved, and replay/show paths keep using the updated table metadata.

Release note

Routine Load now supports altering the target table for a paused single-table Kafka job within the same database.

Check List (For Author)

  • Test

    • 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
        FE unit tests were run; Kafka regression is prepared but not run yet.
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: None
Related PR: None
Problem Summary: Allow paused single-table Routine Load jobs to switch their target table with ALTER ROUTINE LOAD FOR [db.]job ON <table>, while preserving existing progress and replaying the new table binding from edit log.

### Release note

Support ALTER ROUTINE LOAD ... ON <table> to switch the target table for paused single-table routine load jobs.

### Check List (For Author)

- Test: FE unit test
  - "/data/data3/huangruixin/include/src-master/apache-maven-3.9.9/bin/mvn -pl fe-core -am -DskipITs -Dcheckstyle.skip=true -DfailIfNoTests=false -Dtest=org.apache.doris.nereids.trees.plans.commands.AlterRoutineLoadCommandTest,org.apache.doris.persist.AlterRoutineLoadOperationLogTest,org.apache.doris.load.routineload.KafkaRoutineLoadJobTest test"
  - Kinesis unit tests skipped per user request
- Behavior changed: Yes (new ALTER ROUTINE LOAD target-table switch behavior)
- Does this need documentation: Yes (documented in /data/data3/huangruixin/docs/routine-load-alter-table-design.html)
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@0AyanamiRei 0AyanamiRei marked this pull request as draft June 26, 2026 06:04
### What problem does this PR solve?

Issue Number: None

Related PR: apache#64878

Problem Summary: Follow-up review found two issues in the new routine load target-table alter support. First, `AlterRoutineLoadCommand` had an import order regression that could fail FE checkstyle. Second, alter validation only rechecked `PARTIAL_COLUMNS=true` from the current command, which left the effective partial-update state under-validated when the existing job or a `unique_key_update_mode` change required merge-on-write semantics. This change restores import ordering, validates the effective unique key update mode against the destination table, and adds focused FE unit coverage for those cases.

### Release note

Routine Load alter now rejects target-table or unique-key-update changes that are incompatible with partial update requirements.

### Check List (For Author)

- Test: Unit Test
- Behavior changed: Yes
- Does this need documentation: No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants