[BugFix] Restore SHOW CREATE MATERIALIZED VIEW for sync MVs#73396
[BugFix] Restore SHOW CREATE MATERIALIZED VIEW for sync MVs#73396kevincai wants to merge 1 commit into
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Restores SHOW CREATE MATERIALIZED VIEW <sync_mv> support for legacy/sync materialized views (rollup-style MVs stored as MaterializedIndexMeta inside an OlapTable) by re-enabling a fallback resolution path when the regular catalog lookup fails.
Changes:
- Catch
SemanticExceptionfromMetaUtils.getSessionAwareTableand route MV-typedSHOW CREATErequests to a sync-MV scan over OLAP tables. - Add a shared helper to build the canonical 2-column
SHOW CREATE MATERIALIZED VIEWresult schema for both async and sync MV paths. - Add SQL regression coverage and a FE unit test covering
SHOW CREATE MATERIALIZED VIEWfor sync MVs and negative cases forSHOW CREATE TABLE/VIEW.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
fe/fe-core/src/main/java/com/starrocks/qe/ShowExecutor.java |
Restores sync-MV fallback by catching lookup miss and scanning OLAP tables under locks; unifies MV result schema. |
fe/fe-core/src/test/java/com/starrocks/catalog/MaterializedViewTest.java |
Adds a unit test validating SHOW CREATE MATERIALIZED VIEW works for rollup/sync MVs. |
test/sql/test_materialized_view/T/test_show_create_sync_materialized_view |
Adds SQL regression test for SHOW CREATE MATERIALIZED VIEW on a sync MV plus negative cases. |
test/sql/test_materialized_view/R/test_show_create_sync_materialized_view |
Adds expected results for the new SQL regression test. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad402e504f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
41b406d to
61d59c6
Compare
61d59c6 to
b064d41
Compare
b064d41 to
3098beb
Compare
3098beb to
bc5d555
Compare
Sync MVs are mv indexes inside an OLAP table and are not registered as separate Tables in Database.idToTable / nameToTable. Since StarRocks#43162 ("temporary table part-1") replaced the lookup in showCreateInternalCatalogTable with MetaUtils.getSessionAwareTable, which throws SemanticException on miss, the existing fallback that scanned OLAP tables for a matching mv index has been unreachable - SHOW CREATE MATERIALIZED VIEW <sync_mv> has been failing with "Table ... is not found". Catch SemanticException from the lookup and route MV-typed queries to a new findSyncMaterializedViewCreateStmt helper that performs the scan under DB READ (the indexNameToMetaId / indexMetaIdToMeta maps are HashMap-backed and mutated by ALTER, so the scan needs DB-wide exclusion). Non-MV queries rethrow the original "table not found" error unchanged. Signed-off-by: Kevin Cai <kevin.cai@celerdata.com>
bc5d555 to
fe6b001
Compare
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 40 / 44 (90.91%) file detail
|
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Sync MVs are mv indexes inside an OLAP table and are not registered as separate Tables in Database.idToTable / nameToTable. Since #43162 ("temporary table part-1") replaced the lookup in
showCreateInternalCatalogTable with MetaUtils.getSessionAwareTable, which throws SemanticException on miss, the existing fallback that scanned OLAP tables for a matching mv index has been unreachable - SHOW CREATE MATERIALIZED VIEW <sync_mv> has been failing with "Table ... is not found".
Catch SemanticException from the lookup and route MV-typed queries to a new findSyncMaterializedViewCreateStmt helper that performs the scan under DB READ (the indexNameToMetaId / indexMetaIdToMeta maps are HashMap-backed and mutated by ALTER, so the scan needs DB-wide exclusion). Non-MV queries rethrow the original "table not found" error unchanged.
Why I'm doing:
What I'm doing:
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: