Skip to content

Commit

Permalink
fix: sqlness
Browse files Browse the repository at this point in the history
  • Loading branch information
v0y4g3r committed Apr 25, 2023
1 parent a5896f3 commit dab786b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
13 changes: 0 additions & 13 deletions src/catalog/src/datafusion.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/catalog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use table::TableRef;
use crate::error::{CreateTableSnafu, Result};
pub use crate::schema::{SchemaProvider, SchemaProviderRef};

pub mod datafusion;
pub mod error;
pub mod helper;
pub(crate) mod information_schema;
Expand Down
6 changes: 3 additions & 3 deletions src/catalog/src/remote/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ impl CatalogProvider for RemoteCatalogProvider {
let res = remote_schemas
.map(|kv| {
let Kv(k, _) = kv?;
let schema_key = SchemaKey::parse(&String::from_utf8_lossy(&k))
let schema_key = SchemaKey::parse(String::from_utf8_lossy(&k))
.context(InvalidCatalogValueSnafu)?;
Ok(schema_key.schema_name)
})
Expand Down Expand Up @@ -749,7 +749,7 @@ impl SchemaProvider for RemoteSchemaProvider {
let table_names = iter
.map(|kv| {
let Kv(key, _) = kv?;
let regional_key = TableRegionalKey::parse(&String::from_utf8_lossy(&key))
let regional_key = TableRegionalKey::parse(String::from_utf8_lossy(&key))
.context(InvalidCatalogValueSnafu)?;
Ok(regional_key.table_name)
})
Expand All @@ -769,7 +769,7 @@ impl SchemaProvider for RemoteSchemaProvider {
// TODO(hl): we should put engine info in table regional value
// so that here we can use correct engine name
let TableRegionalValue { .. } =
TableRegionalValue::parse(&String::from_utf8_lossy(&v))
TableRegionalValue::parse(String::from_utf8_lossy(&v))
.context(InvalidCatalogValueSnafu)?;

let reference = TableReference {
Expand Down
3 changes: 1 addition & 2 deletions src/frontend/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ impl CatalogManager for FrontendCatalogManager {
.context(catalog::error::CatalogNotFoundSnafu {
catalog_name: catalog,
})?;
let result = catalog.schema(schema).await;
result
catalog.schema(schema).await
}

async fn table(
Expand Down
1 change: 1 addition & 0 deletions src/table/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ impl TableMeta {
meta_builder
.schema(self.schema.clone())
.primary_key_indices(self.primary_key_indices.clone())
.engine(self.engine.clone())
.next_column_id(self.next_column_id);
Ok(meta_builder)
}
Expand Down
12 changes: 10 additions & 2 deletions tests/cases/distributed/alter/rename_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@ SELECT * from t;

ALTER TABLE t RENAME new_table;

Error: 1003(Internal), Operation rename table not implemented yet
Affected Rows: 0

DESC TABLE t;

Error: 4001(TableNotFound), Table `t` not exist

DROP TABLE t;

Affected Rows: 1
Error: 4001(TableNotFound), Table `greptime.public.t` not exist

DROP TABLE new_table;

Error: 1003(Internal), status: Internal, message: "Table route not found: __meta_table_route-greptime-public-new_table-1025", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Tue, 25 Apr 2023 08:16:06 GMT", "content-length": "0"} }

5 changes: 5 additions & 0 deletions tests/cases/distributed/alter/rename_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ SELECT * from t;
-- TODO(LFC): Port test cases from standalone env when distribute rename table is implemented (#723).
ALTER TABLE t RENAME new_table;

DESC TABLE t;

DROP TABLE t;

-- This will fail since we don't alter table routes when renaming table https://github.com/GreptimeTeam/greptimedb/issues/1464
DROP TABLE new_table;

0 comments on commit dab786b

Please sign in to comment.