Skip to content

Support parsing Doris REFRESH MATERIALIZED VIEW syntax - #39582

Merged
terrymanu merged 1 commit into
apache:masterfrom
terrymanu:dev
Aug 23, 2026
Merged

Support parsing Doris REFRESH MATERIALIZED VIEW syntax#39582
terrymanu merged 1 commit into
apache:masterfrom
terrymanu:dev

Conversation

@terrymanu

Copy link
Copy Markdown
Member
  • Add REFRESH MATERIALIZED VIEW (AUTO | COMPLETE | PARTITIONS) grammar rule to the Doris dialect
  • Add DorisRefreshMaterializedViewStatement and visitRefreshMaterializedView to extract mv name, refresh type and partition names
  • Add parser IT cases covering the AUTO, COMPLETE and PARTITIONS variants from issue Support parsing Doris sql #31457

Fixes #31457

- Add REFRESH MATERIALIZED VIEW <mv-name> (AUTO | COMPLETE | PARTITIONS) grammar rule to the Doris dialect
- Add DorisRefreshMaterializedViewStatement and visitRefreshMaterializedView to extract mv name, refresh type and partition names
- Add parser IT cases covering the AUTO, COMPLETE and PARTITIONS variants from issue apache#31457

Fixes apache#31457
@terrymanu

Copy link
Copy Markdown
Member Author

Result

Review Result: Mergeable

PR #39582 adds REFRESH MATERIALIZED VIEW parsing support to the Doris dialect. The grammar matches the official documentation verbatim, the wiring is complete, and the 3 parser IT cases correspond exactly to the official examples; the three-lens discovery and convergence pass found no candidate that passes the Finding Proof Gate as a blocker.

Evidence

  • Official syntax alignment: The official Apache Doris syntax is REFRESH MATERIALIZED VIEW <mv_name> {<partitionSpec> | COMPLETE | AUTO}, where mv_name is defined as a plain identifier (no database-qualified form) and no other clause variants exist (doris.apache.org/docs/dev/sql-manual/sql-statements/table-and-view/async-materialized-view/REFRESH-MATERIALIZED-VIEW/). The PR rule refreshMaterializedView : REFRESH MATERIALIZED VIEW name (partitionSpec | refreshMethod) matches it exactly and reuses the existing refreshMethod (COMPLETE | AUTO), name, and identifierList rules.
  • Ambiguity and regression: The existing refresh rule (parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4:929) only accepts LDAP/CATALOG/DATABASE/TABLE after REFRESH, so its second token never intersects the new rule — no parse ambiguity; both new rules sit inside DORIS ADDED markers, consistent with the MySQL trunk/branch convention.
  • Dialect family: The MySQL trunk has no REFRESH statement and MariaDB has no corresponding rule; the root cause is Doris-specific, so no trunk or sibling-dialect sync is owed.
  • Dispatch registration: SQLVisitorRule.java adds DORIS_REFRESH_MATERIALIZED_VIEW("RefreshMaterializedView", DDL); the prefixed constant name correctly avoids the REFRESH_MATERIALIZED_VIEW constant already taken by PostgreSQL (consistent with the DORIS_DROP_FUNCTION/DORIS_ALTER_SYSTEM precedent).
  • Field extraction and assertions: The visitor extracts mvName, the AUTO/COMPLETE flags, and the partition name list via IdentifierValue; the IT assertions cover all fields — a wrong field extraction or a dropped partition would fail the cases.
  • Local verification (head bc75c1f0; local file list matches GitHub 11/11): rerun of InternalDorisParserITTests run: 1361, Failures: 0, Errors: 0 (exit 0); compile, spotless, and checkstyle on identical content passed earlier (exit 0).
  • Disproved or classified candidates: ① "should support db.mv qualified names" — withdrawn, since the official docs define mv_name as a plain identifier; ② "assertions only check positive flags" — non-blocking, AUTO/COMPLETE exclusivity is grammar-enforced (refreshMethod: COMPLETE | AUTO) and matches the assert style of merged Support parsing Doris CREATE RESOURCE syntax (#31458) #39552; ③ the issue Support parsing Doris sql #31457 checkbox corrections (uncheck the wrongly checked REFRESH, MATERIALIZED, VIEW row, mark CLEAN, PROFILE invalid) are issue-side bookkeeping, outside this PR's code scope.

Coverage

  • Reviewed head: bc75c1f006e509df9e799acb19ff41c3684c57e2 (base 3eefbf7f146, merge-base identical; the local git diff file list matches GitHub /pulls/39582/files 11/11).
  • Behavior clusters: 2 (grammar and statement modeling: 5 files; parser IT coverage: 6 files); all 11 authoritative files registered with risk axes marked; no churn-only files.
  • Completed the three discovery lenses (root cause/behavior, blast radius/contracts, tests/runtime) plus a latest-head convergence pass with 0 new candidates; the review ledger validated and was cleaned up.
  • Official documentation: the Doris dev REFRESH-MATERIALIZED-VIEW page (the old Utility-Statements path was reorganized; the current URL confirmed via the sitemap).
  • This is a Code Correctness Review: the result covers code scope only; GitHub Actions/CI state was not queried or awaited.

@terrymanu
terrymanu merged commit ccc490c into apache:master Aug 23, 2026
27 checks passed
@terrymanu
terrymanu deleted the dev branch August 23, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support parsing Doris sql

2 participants