Skip to content

*: add materialized view DDL syntax#66022

Merged
ti-chi-bot[bot] merged 7 commits intopingcap:feature/release-8.5-materialized-viewfrom
wjhuang2016:mv/scheme2-split-pr1-parser
Feb 6, 2026
Merged

*: add materialized view DDL syntax#66022
ti-chi-bot[bot] merged 7 commits intopingcap:feature/release-8.5-materialized-viewfrom
wjhuang2016:mv/scheme2-split-pr1-parser

Conversation

@wjhuang2016
Copy link
Member

@wjhuang2016 wjhuang2016 commented Feb 4, 2026

What problem does this PR solve?

Issue Number: ref #65936 ref #18023

Problem Summary:

  • The original PR (*: add MV systables + MV/MLOG DDL metadata (scheme2) #65936) is too large to review/merge efficiently. This PR extracts the SQL syntax + AST + planner preprocessing/privilege wiring for Materialized View and Materialized View Log to reduce the review surface area of follow-up executor/infoschema/bootstrap changes.

What changed and how does it work?

  • Parser: add MV/MV LOG/REFRESH related syntax, keywords and AST nodes (includes parser.go regeneration).
  • Planner: extend preprocess/visitInfo to avoid resolving MV names as normal tables during preprocessing.

Note: This PR only introduces syntax and frontend wiring; executor/DDL implementations will come in follow-up PRs.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner labels Feb 4, 2026
@ti-chi-bot ti-chi-bot bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 4, 2026
@wjhuang2016
Copy link
Member Author

Tests:

  • go test -C pkg/parser ./...

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 44.44444% with 275 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (feature/release-8.5-materialized-view@f3af7d5). Learn more about missing BASE report.

Additional details and impacted files
@@                            Coverage Diff                             @@
##             feature/release-8.5-materialized-view     #66022   +/-   ##
==========================================================================
  Coverage                                         ?   57.0830%           
==========================================================================
  Files                                            ?       1784           
  Lines                                            ?     638126           
  Branches                                         ?          0           
==========================================================================
  Hits                                             ?     364262           
  Misses                                           ?     249394           
  Partials                                         ?      24470           
Flag Coverage Δ
integration 37.0423% <0.0000%> (?)
unit 72.6667% <44.4444%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9278% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 52.7388% <0.0000%> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Drop unused MV keywords (INCLUDING/NEW/DEMAND)

- Align CREATE MV refresh on-clause to [START WITH] NEXT

- Add COMPLETE refresh type

- Support TIFLASH REPLICA for MV LOG + ALTER actions

- Extend ALTER MV LOG purge syntax + tests
@wjhuang2016
Copy link
Member Author

/retest

1 similar comment
@wjhuang2016
Copy link
Member Author

/retest

Comment on lines 289 to 290
p.checkCreateViewGrammar(node)
p.checkCreateViewWithSelectGrammar(node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we also add these check for mv?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, MV is not view

case *ast.CreateResourceGroupStmt, *ast.DropResourceGroupStmt, *ast.AlterResourceGroupStmt:
err := plannererrors.ErrSpecificAccessDenied.GenWithStackByArgs("SUPER or RESOURCE_GROUP_ADMIN")
b.visitInfo = appendDynamicVisitInfo(b.visitInfo, []string{"RESOURCE_GROUP_ADMIN"}, false, err)
case *ast.CreateMaterializedViewStmt:
Copy link
Contributor

@fzzf678 fzzf678 Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These case branch has some common logic, better to extract some functions to call.

}

CreateMaterializedViewLogStmt:
"CREATE" "MATERIALIZED" "VIEW" "LOG" "ON" TableName '(' ColumnList ')' MLogOptionClauseOpt MLogPurgeClauseOpt
Copy link
Contributor

@fzzf678 fzzf678 Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, MLogOptionClauseOpt must be placed beforeMLogPurgeClauseOpt, reverse order is not supported. If we want a flexible order, this needs to be adjusted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support the reverse order

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 6, 2026
Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 6, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fzzf678, windtalker
Once this PR has been reviewed and has the lgtm label, please assign benmeadowcroft, elsa0520, tangenta for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 6, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 6, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-02-06 02:46:04.120485885 +0000 UTC m=+407835.221884604: ☑️ agreed by fzzf678.
  • 2026-02-06 03:02:04.983287972 +0000 UTC m=+408796.084686692: ☑️ agreed by windtalker.

@wjhuang2016
Copy link
Member Author

/retest

2 similar comments
@wjhuang2016
Copy link
Member Author

/retest

@wjhuang2016
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 96a16b2 into pingcap:feature/release-8.5-materialized-view Feb 6, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved component/parser lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants