-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[BugFix] Restore SHOW CREATE MATERIALIZED VIEW for sync MVs #73396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kevincai
merged 1 commit into
StarRocks:main
from
kevincai:bugfix/fix-sync-mv-show-create
May 19, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
test/sql/test_materialized_view/R/test_show_create_sync_materialized_view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| -- name: test_show_create_sync_materialized_view @native | ||
| create database test_show_create_sync_mv_${uuid0}; | ||
| -- result: | ||
| -- !result | ||
| use test_show_create_sync_mv_${uuid0}; | ||
| -- result: | ||
| -- !result | ||
| create table sync_mv_base | ||
| ( | ||
| k1 date, | ||
| k2 int, | ||
| v1 int sum | ||
| ) | ||
| distributed by hash(k2) buckets 3 | ||
| properties('replication_num' = '1'); | ||
| -- result: | ||
| -- !result | ||
| create materialized view sync_mv_rollup as select k2, sum(v1) from sync_mv_base group by k2; | ||
| -- result: | ||
| -- !result | ||
| function: wait_materialized_view_finish() | ||
| -- result: | ||
| None | ||
| -- !result | ||
| show create materialized view sync_mv_rollup; | ||
| -- result: | ||
| [REGEX]sync_mv_rollup\tcreate materialized view sync_mv_rollup as select.*from sync_mv_base group by.* | ||
| -- !result | ||
| show create table sync_mv_rollup; | ||
| -- result: | ||
| [REGEX].*Table.*sync_mv_rollup.*is not found.* | ||
| -- !result | ||
| show create view sync_mv_rollup; | ||
| -- result: | ||
| [REGEX].*Table.*sync_mv_rollup.*is not found.* | ||
| -- !result | ||
| drop database test_show_create_sync_mv_${uuid0}; | ||
| -- result: | ||
| -- !result |
34 changes: 34 additions & 0 deletions
34
test/sql/test_materialized_view/T/test_show_create_sync_materialized_view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| -- name: test_show_create_sync_materialized_view @native | ||
|
|
||
| create database test_show_create_sync_mv_${uuid0}; | ||
| use test_show_create_sync_mv_${uuid0}; | ||
|
|
||
| create table sync_mv_base | ||
| ( | ||
| k1 date, | ||
| k2 int, | ||
| v1 int sum | ||
| ) | ||
| distributed by hash(k2) buckets 3 | ||
| properties('replication_num' = '1'); | ||
|
|
||
| -- Sync materialized view (legacy rollup style: no DISTRIBUTED BY, no REFRESH | ||
| -- clause). Stored as a MaterializedIndexMeta inside the base OLAP table, not | ||
| -- as a separately-registered Table. | ||
| create materialized view sync_mv_rollup as select k2, sum(v1) from sync_mv_base group by k2; | ||
| function: wait_materialized_view_finish() | ||
|
|
||
| -- Regression: SHOW CREATE MATERIALIZED VIEW on a sync MV must locate the | ||
| -- MaterializedIndexMeta via the dedicated scan path inside | ||
| -- showCreateInternalCatalogTable. Without the fix this returned | ||
| -- "Table sync_mv_rollup is not found" because the regular name lookup misses | ||
| -- sync MV index names. | ||
| show create materialized view sync_mv_rollup; | ||
|
|
||
| -- Negative cases: SHOW CREATE TABLE / VIEW on a sync MV name must still fail | ||
| -- with "Table not found" (the fallback scan is only entered for MV-typed | ||
| -- queries; see ShowExecutor.showCreateInternalCatalogTable). | ||
| show create table sync_mv_rollup; | ||
| show create view sync_mv_rollup; | ||
|
|
||
| drop database test_show_create_sync_mv_${uuid0}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.