Skip to content

Commit 97b0692

Browse files
authored
feat(query): support create/drop table under iceberg catalog (#17619)
* feat(query): support create/drop table under iceberg catalog Now we only support create table without partition and options; * fix test
1 parent d9a2145 commit 97b0692

File tree

13 files changed

+208
-7
lines changed

13 files changed

+208
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/meta/api/src/schema_api_test_suite.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,7 @@ impl SchemaApiTestSuite {
14901490
if_exists: false,
14911491
tenant: tenant.clone(),
14921492
db_id: *db_id,
1493+
db_name: "db".to_string(),
14931494
table_name: table_name.to_string(),
14941495
tb_id: table_id,
14951496
engine: "FUSE".to_string(),
@@ -1811,6 +1812,7 @@ impl SchemaApiTestSuite {
18111812
if_exists: false,
18121813
tenant: tenant.clone(),
18131814
db_id: *db_id,
1815+
db_name: "db1".to_string(),
18141816
table_name: tbl_name.to_string(),
18151817
tb_id,
18161818
engine: "FUSE".to_string(),
@@ -1868,6 +1870,7 @@ impl SchemaApiTestSuite {
18681870
db_id: *db_id,
18691871
table_name: tbl_name.to_string(),
18701872
tb_id,
1873+
db_name: "db3".to_string(),
18711874
engine: "FUSE".to_string(),
18721875
session_id: "".to_string(),
18731876
};
@@ -1889,6 +1892,7 @@ impl SchemaApiTestSuite {
18891892
db_id: *db_id,
18901893
table_name: tbl_name.to_string(),
18911894
tb_id,
1895+
db_name: "db3".to_string(),
18921896
engine: "FUSE".to_string(),
18931897
session_id: "".to_string(),
18941898
};
@@ -4304,6 +4308,7 @@ impl SchemaApiTestSuite {
43044308
if_exists: false,
43054309
tenant: req.name_ident.tenant.clone(),
43064310
db_id: *db2_id,
4311+
db_name: "db2".to_string(),
43074312
table_name: req.name_ident.table_name.clone(),
43084313
tb_id: resp.table_id,
43094314
engine: "FUSE".to_string(),
@@ -4326,6 +4331,7 @@ impl SchemaApiTestSuite {
43264331
if_exists: false,
43274332
tenant: req.name_ident.tenant.clone(),
43284333
db_id: *db2_id,
4334+
db_name: "db2".to_string(),
43294335
table_name: req.name_ident.table_name.clone(),
43304336
tb_id: resp.table_id,
43314337
engine: "FUSE".to_string(),
@@ -4400,6 +4406,7 @@ impl SchemaApiTestSuite {
44004406
if_exists: false,
44014407
tenant: req.name_ident.tenant.clone(),
44024408
db_id: *db3_id,
4409+
db_name: "db3".to_string(),
44034410
table_name: req.name_ident.table_name.clone(),
44044411
tb_id: resp.table_id,
44054412
engine: "FUSE".to_string(),
@@ -4423,6 +4430,7 @@ impl SchemaApiTestSuite {
44234430
if_exists: false,
44244431
tenant: req.name_ident.tenant.clone(),
44254432
db_id: *db3_id,
4433+
db_name: "db3".to_string(),
44264434
table_name: req.name_ident.table_name.clone(),
44274435
tb_id: resp.table_id,
44284436
engine: "FUSE".to_string(),
@@ -4597,6 +4605,7 @@ impl SchemaApiTestSuite {
45974605
tenant: req.name_ident.tenant.clone(),
45984606
db_id,
45994607
table_name: req.name_ident.table_name.clone(),
4608+
db_name: db.to_string(),
46004609
tb_id: resp.table_id,
46014610
engine: "FUSE".to_string(),
46024611
session_id: "".to_string(),
@@ -4840,6 +4849,7 @@ impl SchemaApiTestSuite {
48404849
tenant: tbl_name_ident.tenant.clone(),
48414850
db_id: old_db.database_id.db_id,
48424851
table_name: tbl_name_ident.table_name.clone(),
4852+
db_name: db_name.to_string(),
48434853
tb_id,
48444854
engine: "FUSE".to_string(),
48454855
session_id: "".to_string(),
@@ -4885,6 +4895,7 @@ impl SchemaApiTestSuite {
48854895
tenant: tenant.clone(),
48864896
db_id: old_db.database_id.db_id,
48874897
table_name: tbl_name.to_string(),
4898+
db_name: db_name.to_string(),
48884899
tb_id,
48894900
engine: "FUSE".to_string(),
48904901
session_id: "".to_string(),
@@ -4936,6 +4947,7 @@ impl SchemaApiTestSuite {
49364947
tenant: tenant.clone(),
49374948
db_id: old_db.database_id.db_id,
49384949
table_name: tbl_name.to_string(),
4950+
db_name: tbl_name.to_string(),
49394951
tb_id: tb_info.ident.table_id,
49404952
engine: "FUSE".to_string(),
49414953
session_id: "".to_string(),
@@ -5023,6 +5035,7 @@ impl SchemaApiTestSuite {
50235035
tenant: tenant.clone(),
50245036
db_id: cur_db.database_id.db_id,
50255037
table_name: tbl_name.to_string(),
5038+
db_name: db_name.to_string(),
50265039
tb_id: new_tb_info.ident.table_id,
50275040
engine: "FUSE".to_string(),
50285041
session_id: "".to_string(),
@@ -8214,6 +8227,7 @@ where MT: SchemaApi + kvapi::AsKVApi<Error = MetaError>
82148227
if_exists: false,
82158228
db_id: self.db_id,
82168229
tb_id: self.table_id,
8230+
db_name: "".to_string(),
82178231
engine: "FUSE".to_string(),
82188232
session_id: "".to_string(),
82198233
};

src/meta/app/src/schema/table.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,8 @@ pub struct DropTableByIdReq {
605605

606606
pub db_id: MetaId,
607607

608+
pub db_name: String,
609+
608610
pub engine: String,
609611

610612
pub session_id: String,

src/meta/binaries/metabench/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ async fn benchmark_table(client: &Arc<ClientHandle>, prefix: u64, client_num: u6
236236
if_exists: false,
237237
tenant: tenant(),
238238
db_id,
239+
db_name: db_name().to_string(),
239240
table_name: table_name(),
240241
tb_id: t.ident.table_id,
241242
engine: "FUSE".to_string(),

src/query/ee/src/stream/handler.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ impl StreamHandler for RealStreamHandler {
190190
table_name: stream_name.clone(),
191191
tb_id: table.get_id(),
192192
db_id: db.get_db_info().database_id.db_id,
193+
db_name: db.name().to_string(),
193194
engine: engine.to_string(),
194195
session_id: "".to_string(),
195196
})

src/query/service/src/interpreters/interpreter_table_drop.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ impl Interpreter for DropTableInterpreter {
124124
table_name: tbl_name.to_string(),
125125
tb_id: tbl.get_table_info().ident.table_id,
126126
db_id: db.get_db_info().database_id.db_id,
127+
db_name: db.name().to_string(),
127128
engine: tbl.engine().to_string(),
128129
session_id: tbl
129130
.options()

src/query/service/src/interpreters/interpreter_view_drop.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ impl Interpreter for DropViewInterpreter {
9494
table_name: self.plan.view_name.clone(),
9595
tb_id: table.get_id(),
9696
db_id: db.get_db_info().database_id.db_id,
97+
db_name: db.name().to_string(),
9798
engine: table.engine().to_string(),
9899
session_id: table
99100
.options()

src/query/service/src/sessions/query_ctx.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,7 @@ impl TableContext for QueryContext {
17731773
tb_id: table.get_table_info().ident.table_id,
17741774
table_name: table_name.to_string(),
17751775
db_id: db.get_db_info().database_id.db_id,
1776+
db_name: db.name().to_string(),
17761777
engine: table.engine().to_string(),
17771778
session_id: table
17781779
.options()

src/query/service/tests/it/catalogs/database_catalog.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ async fn test_catalogs_table() -> Result<()> {
191191
table_name: "test_table".to_string(),
192192
tb_id: tbl.get_table_info().ident.table_id,
193193
db_id: db.get_db_info().database_id.db_id,
194+
db_name: db.name().to_string(),
194195
engine: tbl.engine().to_string(),
195196
session_id: "".to_string(),
196197
})

src/query/storages/iceberg/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ license = "Apache-2.0"
77
publish = false
88

99
[dependencies]
10+
arrow-schema = { workspace = true }
1011
async-backtrace = { workspace = true }
1112
async-trait = { workspace = true }
1213
chrono = { workspace = true }

0 commit comments

Comments
 (0)