Skip to content

Commit

Permalink
make creating mvs visible
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel committed Oct 24, 2024
1 parent 788a50a commit 765702c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions e2e_test/ddl/drop/drop_creating_mv.slt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ statement ok
drop materialized view m1;

############## Test drop background mv BEFORE recovery

statement ok
set background_ddl=true;

Expand Down
8 changes: 8 additions & 0 deletions src/frontend/src/catalog/schema_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,14 @@ impl SchemaCatalog {
}

/// Iterate all materialized views, excluding the indices.
pub fn iter_all_mvs(&self) -> impl Iterator<Item = &Arc<TableCatalog>> {
self.table_by_name
.iter()
.filter(|(_, v)| v.is_mview() && valid_table_name(&v.name))
.map(|(_, v)| v)
}

/// Iterate created materialized views, excluding the indices.
pub fn iter_created_mvs(&self) -> impl Iterator<Item = &Arc<TableCatalog>> {
self.table_by_name
.iter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn read_rw_materialized_views(reader: &SysCatalogReaderImpl) -> Result<Vec<RwMat

Ok(schemas
.flat_map(|schema| {
schema.iter_created_mvs().map(|table| RwMaterializedView {
schema.iter_all_mvs().map(|table| RwMaterializedView {
id: table.id.table_id as i32,
name: table.name().into(),
schema_id: schema.id() as i32,
Expand Down

0 comments on commit 765702c

Please sign in to comment.