Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel committed Jul 2, 2024
1 parent 8db729c commit 1a22eda
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/frontend/src/catalog/schema_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ impl SchemaCatalog {
pub fn get_created_table_by_name(&self, table_name: &str) -> Option<&Arc<TableCatalog>> {
self.table_by_name
.get(table_name)
.filter(|&table| table.stream_job_status != StreamJobStatus::Creating)
.filter(|&table| table.stream_job_status == StreamJobStatus::Created)
}

pub fn get_table_by_id(&self, table_id: &TableId) -> Option<&Arc<TableCatalog>> {
Expand All @@ -622,7 +622,7 @@ impl SchemaCatalog {
pub fn get_created_table_by_id(&self, table_id: &TableId) -> Option<&Arc<TableCatalog>> {
self.table_by_id
.get(table_id)
.filter(|&table| table.stream_job_status != StreamJobStatus::Creating)
.filter(|&table| table.stream_job_status == StreamJobStatus::Created)
}

pub fn get_view_by_name(&self, view_name: &str) -> Option<&Arc<ViewCatalog>> {
Expand Down
3 changes: 1 addition & 2 deletions src/frontend/src/handler/alter_rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ pub async fn handle_rename_database(

#[cfg(test)]
mod tests {

use risingwave_common::catalog::{DEFAULT_DATABASE_NAME, DEFAULT_SCHEMA_NAME};

use crate::catalog::root_catalog::SchemaPath;
Expand All @@ -350,7 +349,7 @@ mod tests {
let table_id = {
let catalog_reader = session.env().catalog_reader().read_guard();
catalog_reader
.get_created_table_by_name(DEFAULT_DATABASE_NAME, schema_path, "t")
.get_table_by_name(DEFAULT_DATABASE_NAME, schema_path, "t")
.unwrap()
.0
.id
Expand Down
5 changes: 3 additions & 2 deletions src/frontend/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ use risingwave_hummock_sdk::version::{HummockVersion, HummockVersionDelta};
use risingwave_pb::backup_service::MetaSnapshotMetadata;
use risingwave_pb::catalog::table::OptionalAssociatedSourceId;
use risingwave_pb::catalog::{
PbComment, PbDatabase, PbFunction, PbIndex, PbSchema, PbSink, PbSource, PbSubscription,
PbTable, PbView, Table,
PbComment, PbDatabase, PbFunction, PbIndex, PbSchema, PbSink, PbSource, PbStreamJobStatus,
PbSubscription, PbTable, PbView, Table,
};
use risingwave_pb::common::WorkerNode;
use risingwave_pb::ddl_service::alter_owner_request::Object;
Expand Down Expand Up @@ -274,6 +274,7 @@ impl CatalogWriter for MockCatalogWriter {
_graph: StreamFragmentGraph,
) -> Result<()> {
table.id = self.gen_id();
table.stream_job_status = PbStreamJobStatus::Created as _;
self.catalog.write().create_table(&table);
self.add_table_or_source_id(table.id, table.schema_id, table.database_id);
Ok(())
Expand Down

0 comments on commit 1a22eda

Please sign in to comment.