Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel committed Jul 4, 2024
1 parent a188fb3 commit 5bd5fc4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/frontend/src/catalog/root_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ impl Catalog {
}

/// This function is similar to `get_table_by_id` expect that a table must be in a given database.
pub fn get_table_by_id_with_db(
pub fn get_created_table_by_id_with_db(
&self,
db_name: &str,
table_id: u32,
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/catalog/schema_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ impl SchemaCatalog {
}

/// Iterate all materialized views, excluding the indices.
pub fn iter_mv(&self) -> impl Iterator<Item = &Arc<TableCatalog>> {
pub fn iter_created_mvs(&self) -> impl Iterator<Item = &Arc<TableCatalog>> {
self.table_by_name
.iter()
.filter(|(_, v)| v.is_mview() && valid_table_name(&v.name) && v.is_created())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn read_rw_materialized_views(reader: &SysCatalogReaderImpl) -> Result<Vec<RwMat

Ok(schemas
.flat_map(|schema| {
schema.iter_mv().map(|table| RwMaterializedView {
schema.iter_created_mvs().map(|table| RwMaterializedView {
id: table.id.table_id as i32,
name: table.name().into(),
schema_id: schema.id() as i32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async fn read_relation_info(reader: &SysCatalogReaderImpl) -> Result<Vec<RwRelat
let schema_catalog =
catalog_reader.get_schema_by_name(&reader.auth_context.database, schema)?;

schema_catalog.iter_mv().for_each(|t| {
schema_catalog.iter_created_mvs().for_each(|t| {
table_ids.push(t.id.table_id);
});

Expand Down Expand Up @@ -78,7 +78,7 @@ async fn read_relation_info(reader: &SysCatalogReaderImpl) -> Result<Vec<RwRelat
for schema in &schemas {
let schema_catalog =
catalog_reader.get_schema_by_name(&reader.auth_context.database, schema)?;
schema_catalog.iter_mv().for_each(|t| {
schema_catalog.iter_created_mvs().for_each(|t| {
if let Some(fragments) = table_fragments.get(&t.id.table_id) {
rows.push(RwRelationInfo {
schemaname: schema.clone(),
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/expr/function_impl/pg_get_viewdef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn pg_get_viewdef_impl(
if let Ok(view) = catalog_reader.get_view_by_id(db_name, oid as u32) {
write!(writer, "{}", view.sql).unwrap();
Ok(())
} else if let Ok(mv) = catalog_reader.get_table_by_id_with_db(db_name, oid as u32) {
} else if let Ok(mv) = catalog_reader.get_created_table_by_id_with_db(db_name, oid as u32) {
let stmts = Parser::parse_sql(&mv.definition).map_err(|e| anyhow!(e))?;
let [stmt]: [_; 1] = stmts.try_into().unwrap();

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/handler/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ pub async fn handle_show_object(
ShowObject::MaterializedView { schema } => catalog_reader
.read_guard()
.get_schema_by_name(session.database(), &schema_or_default(&schema))?
.iter_mv()
.iter_created_mvs()
.map(|t| t.name.clone())
.collect(),
ShowObject::Source { schema } => catalog_reader
Expand Down

0 comments on commit 5bd5fc4

Please sign in to comment.