Skip to content

Commit e0b3e40

Browse files
committed
Move all table DDL
Signed-off-by: Xuanwo <github@xuanwo.io>
1 parent af24809 commit e0b3e40

39 files changed

+108
-180
lines changed

src/query/catalog/src/table.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use common_legacy_planners::Extras;
2929
use common_legacy_planners::Partitions;
3030
use common_legacy_planners::ReadDataSourcePlan;
3131
use common_legacy_planners::Statistics;
32-
use common_legacy_planners::TruncateTablePlan;
3332
use common_meta_app::schema::TableInfo;
3433
use common_meta_types::MetaId;
3534
use common_pipeline_core::Pipeline;
@@ -166,7 +165,8 @@ pub trait Table: Sync + Send {
166165
async fn truncate(
167166
&self,
168167
_ctx: Arc<dyn TableContext>,
169-
_truncate_plan: TruncateTablePlan,
168+
_catalog_name: &str,
169+
_purge: bool,
170170
) -> Result<()> {
171171
Err(ErrorCode::UnImplement(format!(
172172
"truncate for table {} is not implemented",

src/query/legacy-planners/src/lib.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,7 @@ mod plan_setting;
5454
mod plan_sink;
5555
mod plan_sort;
5656
mod plan_subqueries_set;
57-
mod plan_table_alter_cluster_key;
58-
mod plan_table_describe;
59-
mod plan_table_drop;
60-
mod plan_table_drop_cluster_key;
61-
mod plan_table_exists;
62-
mod plan_table_optimize;
6357
mod plan_table_recluster;
64-
mod plan_table_rename;
65-
mod plan_table_show_create;
66-
mod plan_table_truncate;
67-
mod plan_table_undrop;
68-
mod plan_use_database;
6958
mod plan_user_alter;
7059
mod plan_user_create;
7160
mod plan_user_drop;
@@ -162,20 +151,7 @@ pub use plan_sink::SinkPlan;
162151
pub use plan_sink::SINK_SCHEMA;
163152
pub use plan_sort::SortPlan;
164153
pub use plan_subqueries_set::SubQueriesSetPlan;
165-
pub use plan_table_alter_cluster_key::AlterTableClusterKeyPlan;
166-
pub use plan_table_describe::DescribeTablePlan;
167-
pub use plan_table_drop::DropTablePlan;
168-
pub use plan_table_drop_cluster_key::DropTableClusterKeyPlan;
169-
pub use plan_table_exists::ExistsTablePlan;
170-
pub use plan_table_optimize::OptimizeTableAction;
171-
pub use plan_table_optimize::OptimizeTablePlan;
172154
pub use plan_table_recluster::ReclusterTablePlan;
173-
pub use plan_table_rename::RenameTableEntity;
174-
pub use plan_table_rename::RenameTablePlan;
175-
pub use plan_table_show_create::ShowCreateTablePlan;
176-
pub use plan_table_truncate::TruncateTablePlan;
177-
pub use plan_table_undrop::UndropTablePlan;
178-
pub use plan_use_database::UseDatabasePlan;
179155
pub use plan_user_alter::AlterUserPlan;
180156
pub use plan_user_create::CreateUserPlan;
181157
pub use plan_user_drop::DropUserPlan;

src/query/legacy-planners/src/plan_table_describe.rs renamed to src/query/planner/src/plans/describe_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Datafuse Labs.
1+
// Copyright 2022 Datafuse Labs.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

src/query/legacy-planners/src/plan_table_drop.rs renamed to src/query/planner/src/plans/drop_table.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Datafuse Labs.
1+
// Copyright 2022 Datafuse Labs.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
1514
use std::sync::Arc;
1615

1716
use common_datavalues::DataSchema;

src/query/legacy-planners/src/plan_table_drop_cluster_key.rs renamed to src/query/planner/src/plans/drop_table_cluster_key.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
1514
use std::sync::Arc;
1615

1716
use common_datavalues::DataSchema;

src/query/legacy-planners/src/plan_table_exists.rs renamed to src/query/planner/src/plans/exists_table.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
1514
use std::sync::Arc;
1615

1716
use common_datavalues::DataField;

src/query/planner/src/plans/mod.rs

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,59 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
mod alter_table_cluster_key;
1516
mod call;
16-
pub use call::CallPlan;
17-
1817
mod create_database;
19-
pub use create_database::CreateDatabasePlan;
20-
2118
mod create_role;
22-
pub use create_role::CreateRolePlan;
23-
19+
mod describe_table;
2420
mod drop_database;
25-
pub use drop_database::DropDatabasePlan;
26-
2721
mod drop_role;
28-
pub use drop_role::DropRolePlan;
29-
22+
mod drop_table;
23+
mod drop_table_cluster_key;
24+
mod exists_table;
3025
mod grant_privilege;
31-
pub use grant_privilege::GrantPrivilegePlan;
32-
3326
mod grant_role;
34-
pub use grant_role::GrantRolePlan;
35-
3627
mod kill;
37-
pub use kill::KillPlan;
38-
3928
mod list;
40-
pub use list::ListPlan;
41-
29+
mod optimize_table;
4230
mod rename_database;
31+
mod rename_table;
32+
mod revoke_privilege;
33+
mod revoke_role;
34+
mod show_create_database;
35+
mod show_create_table;
36+
mod show_grants;
37+
mod truncate_table;
38+
mod undrop_database;
39+
mod undrop_table;
40+
mod use_database;
41+
42+
pub use alter_table_cluster_key::AlterTableClusterKeyPlan;
43+
pub use call::CallPlan;
44+
pub use create_database::CreateDatabasePlan;
45+
pub use create_role::CreateRolePlan;
46+
pub use describe_table::DescribeTablePlan;
47+
pub use drop_database::DropDatabasePlan;
48+
pub use drop_role::DropRolePlan;
49+
pub use drop_table::DropTablePlan;
50+
pub use drop_table_cluster_key::DropTableClusterKeyPlan;
51+
pub use exists_table::ExistsTablePlan;
52+
pub use grant_privilege::GrantPrivilegePlan;
53+
pub use grant_role::GrantRolePlan;
54+
pub use kill::KillPlan;
55+
pub use list::ListPlan;
56+
pub use optimize_table::OptimizeTableAction;
57+
pub use optimize_table::OptimizeTablePlan;
4358
pub use rename_database::RenameDatabaseEntity;
4459
pub use rename_database::RenameDatabasePlan;
45-
46-
mod revoke_privilege;
60+
pub use rename_table::RenameTableEntity;
61+
pub use rename_table::RenameTablePlan;
4762
pub use revoke_privilege::RevokePrivilegePlan;
48-
49-
mod revoke_role;
5063
pub use revoke_role::RevokeRolePlan;
51-
52-
mod show_create_database;
5364
pub use show_create_database::ShowCreateDatabasePlan;
54-
55-
mod show_grants;
65+
pub use show_create_table::ShowCreateTablePlan;
5666
pub use show_grants::ShowGrantsPlan;
57-
58-
mod undrop_database;
67+
pub use truncate_table::TruncateTablePlan;
5968
pub use undrop_database::UndropDatabasePlan;
69+
pub use undrop_table::UndropTablePlan;
70+
pub use use_database::UseDatabasePlan;

src/query/legacy-planners/src/plan_table_optimize.rs renamed to src/query/planner/src/plans/optimize_table.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Datafuse Labs.
1+
// Copyright 2022 Datafuse Labs.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
1514
use std::sync::Arc;
1615

1716
use common_datavalues::DataSchema;

src/query/legacy-planners/src/plan_table_rename.rs renamed to src/query/planner/src/plans/rename_table.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Datafuse Labs.
1+
// Copyright 2022 Datafuse Labs.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
1514
use std::sync::Arc;
1615

1716
use common_datavalues::DataSchema;

0 commit comments

Comments
 (0)