Skip to content

[improvement](fe) Support hour-offset date_add/date_sub in MTMV partition rollup#62410

Open
hakanuzum wants to merge 1 commit intoapache:masterfrom
hakanuzum:feat/mtmv-date-add-interval-partition
Open

[improvement](fe) Support hour-offset date_add/date_sub in MTMV partition rollup#62410
hakanuzum wants to merge 1 commit intoapache:masterfrom
hakanuzum:feat/mtmv-date-add-interval-partition

Conversation

@hakanuzum
Copy link
Copy Markdown

@hakanuzum hakanuzum commented Apr 12, 2026

What problem does this PR solve?

Issue Number: close #62395

Related PR: None

Problem Summary:
MTMV partition rollup only handled date_trunc(partition_col, unit). It could not track partition lineage when the MV partition expression uses hour offset conversion such as:

  • date_trunc(date_add(k2, INTERVAL 3 HOUR), 'day')
  • date_trunc(date_sub(k2, INTERVAL 3 HOUR), 'day')

This is needed for UTC-storage and local-day partitioning workflows.

Release note

Support MTMV partition rollup and partition increment check for
date_trunc(date_add/date_sub(partition_col, INTERVAL N HOUR), unit).

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

Manual test steps:

  • FE build: MVN_OPT='-Dmaven.build.cache.enabled=false' ./build.sh --fe --clean -j$(nproc)

  • FE UT: ./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVRelatedPartitionDescRollUpGeneratorTest

  • Regression case command: ./run-regression-test.sh --run -d mtmv_p0 -s test_rollup_partition_mtmv_date_add

  • Note: regression case requires running FE/BE regression cluster. Local run failed with connection refused when cluster was not started.

  • Behavior changed:

    • No.
    • Yes. date_trunc(date_add/date_sub(...), unit) lineage is now supported for MTMV partition rollup/increment check.
  • 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

…tion rollup

### What problem does this PR solve?

Issue Number: close apache#62395

Related PR: None

Problem Summary: MTMV partition rollup only handled `date_trunc(partition_col, unit)`. It could not track partition lineage when the MV partition expression uses hour offset conversion such as `date_trunc(date_add(k2, INTERVAL 3 HOUR), 'day')` or `date_trunc(date_sub(k2, INTERVAL 3 HOUR), 'day')`, which is needed for UTC-to-local-day partitioning and incremental maintenance.

### Release note

Support MTMV partition rollup and partition increment check for `date_trunc(date_add/date_sub(partition_col, INTERVAL N HOUR), unit)`.

### Check List (For Author)

- Test: Regression test / Unit Test
    - Unit Test: `./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVRelatedPartitionDescRollUpGeneratorTest`
    - Build: `MVN_OPT='-Dmaven.build.cache.enabled=false' ./build.sh --fe --clean -j$(nproc)`
    - Regression test: `./run-regression-test.sh --run -d mtmv_p0 -s test_rollup_partition_mtmv_date_add` (failed locally because FE/BE test cluster was not started; connection refused)
- Behavior changed: Yes (MTMV partition expression now supports hour-offset `date_add/date_sub` lineage under `date_trunc`)
- Does this need documentation: No
@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?

@hakanuzum
Copy link
Copy Markdown
Author

run buildall

@hakanuzum hakanuzum changed the title [improvement](fe) support hour-offset date_add/date_sub in mtmv partition rollup [improvement](fe) Support hour-offset date_add/date_sub in MTMV partition rollup Apr 12, 2026
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.

[Feature] Support arbitrary scalar functions in materialized view partition expressions (e.g. CONVERT_TZ, DATE_ADD, CAST)

2 participants