Skip to content

Commit

Permalink
refactor: catalog (#1454)
Browse files Browse the repository at this point in the history
* wip

* add schema_async

* remove CatalogList

* remove catalog provider and schema provider

* fix

* fix: rename table

* fix: sqlness

* fix: ignore tonic error metadata

* fix: table engine name

* feat: rename catalog_async to catalog

* respect engine name in table regional value when deregistering tables

* fix: CR
  • Loading branch information
v0y4g3r authored Apr 26, 2023
1 parent ef4e473 commit fb9978e
Show file tree
Hide file tree
Showing 59 changed files with 998 additions and 1,227 deletions.
15 changes: 0 additions & 15 deletions src/catalog/src/datafusion.rs

This file was deleted.

324 changes: 0 additions & 324 deletions src/catalog/src/datafusion/catalog_adapter.rs

This file was deleted.

1 change: 1 addition & 0 deletions src/catalog/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ impl TableRegionalKey {
pub struct TableRegionalValue {
pub version: TableVersion,
pub regions_ids: Vec<u32>,
pub engine_name: Option<String>,
}

pub struct CatalogKey {
Expand Down
4 changes: 2 additions & 2 deletions src/catalog/src/information_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl SchemaProvider for InformationSchemaProvider {
self
}

fn table_names(&self) -> Result<Vec<String>> {
async fn table_names(&self) -> Result<Vec<String>> {
Ok(vec![TABLES.to_string()])
}

Expand All @@ -74,7 +74,7 @@ impl SchemaProvider for InformationSchemaProvider {
Ok(Some(Arc::new(table)))
}

fn table_exist(&self, name: &str) -> Result<bool> {
async fn table_exist(&self, name: &str) -> Result<bool> {
Ok(matches!(name.to_ascii_lowercase().as_str(), TABLES))
}
}
6 changes: 3 additions & 3 deletions src/catalog/src/information_schema/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ impl InformationSchemaTablesBuilder {
async fn make_tables(&mut self) -> Result<RecordBatch> {
let catalog_name = self.catalog_name.clone();

for schema_name in self.catalog_provider.schema_names()? {
for schema_name in self.catalog_provider.schema_names().await? {
if schema_name == INFORMATION_SCHEMA_NAME {
continue;
}

let Some(schema) = self.catalog_provider.schema(&schema_name)? else { continue };
for table_name in schema.table_names()? {
let Some(schema) = self.catalog_provider.schema(&schema_name).await? else { continue };
for table_name in schema.table_names().await? {
let Some(table) = schema.table(&table_name).await? else { continue };
let table_info = table.table_info();
self.add_table(
Expand Down
Loading

0 comments on commit fb9978e

Please sign in to comment.