Skip to content

Commit

Permalink
chore: show create table with location (#14778)
Browse files Browse the repository at this point in the history
show create table with location
  • Loading branch information
ariesdevil authored Feb 28, 2024
1 parent 4def8bb commit 8c13fee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ impl ShowCreateTableInterpreter {
});
}

if engine != "ICEBERG" && engine != "DELTA" {
if let Some(sp) = &table_info.meta.storage_params {
table_create_sql.push_str(format!(" LOCATION = '{}'", sp).as_str());
}
}

if !table_info.meta.comment.is_empty() {
table_create_sql.push_str(format!(" COMMENT = '{}'", table_info.meta.comment).as_str());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ SHOW CREATE TABLE `test`.`c`
----
c CREATE TABLE `c` ( `a` INT NOT NULL ) ENGINE=FUSE CLUSTER BY (a, (a % 3)) COMPRESSION='lz4' STORAGE_FORMAT='parquet'

statement ok
CREATE TABLE test.d (a int not null) ENGINE=FUSE 's3://load/files/' CONNECTION=(access_key_id='1a2b3c' aws_secret_key='4x5y6z') CLUSTER BY (a, (a % 3)) COMPRESSION='lz4' STORAGE_FORMAT='parquet'

query TT
SHOW CREATE TABLE `test`.`d`
----
d CREATE TABLE `d` ( `a` INT NOT NULL ) ENGINE=FUSE CLUSTER BY (a, (a % 3)) COMPRESSION='lz4' STORAGE_FORMAT='parquet' LOCATION = 's3 | bucket=load,root=/files/,endpoint=https://s3.amazonaws.com'

query TT
SHOW CREATE TABLE `test`.`c`
----
c CREATE TABLE `c` ( `a` INT NOT NULL ) ENGINE=FUSE CLUSTER BY (a, (a % 3)) COMPRESSION='lz4' STORAGE_FORMAT='parquet'

statement ok
DROP TABLE `test`.`a`

Expand Down

0 comments on commit 8c13fee

Please sign in to comment.