Skip to content

Commit 42c0883

Browse files
authored
Merge pull request #7762 from Xuanwo/remove-old-create-interpreter
refactor: Remove the old planner's interpreter creation
2 parents 9edc528 + a920a22 commit 42c0883

File tree

62 files changed

+543
-788
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+543
-788
lines changed

src/query/service/src/interpreters/access/accessor.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use std::collections::HashMap;
1616
use std::sync::Arc;
1717

1818
use common_exception::Result;
19-
use common_legacy_planners::PlanNode;
2019

2120
use crate::interpreters::access::PrivilegeAccess;
2221
use crate::interpreters::ManagementModeAccess;
@@ -25,12 +24,8 @@ use crate::sql::plans::Plan;
2524

2625
#[async_trait::async_trait]
2726
pub trait AccessChecker: Sync + Send {
28-
// Check the access permission for the old plan.
29-
// TODO(bohu): Remove after new plan done.
30-
async fn check(&self, plan: &PlanNode) -> Result<()>;
31-
32-
// Check the access permission for the old plan.
33-
async fn check_new(&self, _plan: &Plan) -> Result<()>;
27+
// Check the access permission for the plan.
28+
async fn check(&self, _plan: &Plan) -> Result<()>;
3429
}
3530

3631
pub struct Accessor {
@@ -48,17 +43,10 @@ impl Accessor {
4843
Accessor { accessors }
4944
}
5045

51-
pub async fn check(&self, plan: &PlanNode) -> Result<()> {
46+
pub async fn check(&self, plan: &Plan) -> Result<()> {
5247
for accessor in self.accessors.values() {
5348
accessor.check(plan).await?;
5449
}
5550
Ok(())
5651
}
57-
58-
pub async fn check_new(&self, plan: &Plan) -> Result<()> {
59-
for accessor in self.accessors.values() {
60-
accessor.check_new(plan).await?;
61-
}
62-
Ok(())
63-
}
6452
}

src/query/service/src/interpreters/access/management_mode_access.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use std::sync::Arc;
1616

1717
use common_exception::ErrorCode;
1818
use common_exception::Result;
19-
use common_legacy_planners::PlanNode;
2019

2120
use crate::interpreters::access::AccessChecker;
2221
use crate::sessions::QueryContext;
@@ -36,22 +35,7 @@ impl ManagementModeAccess {
3635
#[async_trait::async_trait]
3736
impl AccessChecker for ManagementModeAccess {
3837
// Check what we can do if in management mode.
39-
async fn check(&self, plan: &PlanNode) -> Result<()> {
40-
// Allows for management-mode.
41-
if self.ctx.get_config().query.management_mode {
42-
return match plan {
43-
PlanNode::Empty(_) => Ok(()),
44-
_ => Err(ErrorCode::ManagementModePermissionDenied(format!(
45-
"Access denied for operation:{:?} in management-mode",
46-
plan.name()
47-
))),
48-
};
49-
};
50-
Ok(())
51-
}
52-
53-
// Check what we can do if in management mode.
54-
async fn check_new(&self, plan: &Plan) -> Result<()> {
38+
async fn check(&self, plan: &Plan) -> Result<()> {
5539
// Allows for management-mode.
5640
if self.ctx.get_config().query.management_mode {
5741
let ok = match plan {

src/query/service/src/interpreters/access/privilege_access.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use std::sync::Arc;
1616

1717
use common_exception::Result;
18-
use common_legacy_planners::PlanNode;
1918
use common_meta_types::GrantObject;
2019
use common_meta_types::UserPrivilegeType;
2120

@@ -35,12 +34,7 @@ impl PrivilegeAccess {
3534

3635
#[async_trait::async_trait]
3736
impl AccessChecker for PrivilegeAccess {
38-
async fn check(&self, _plan: &PlanNode) -> Result<()> {
39-
// The old planner *NO* need to check anymore.
40-
Ok(())
41-
}
42-
43-
async fn check_new(&self, plan: &Plan) -> Result<()> {
37+
async fn check(&self, plan: &Plan) -> Result<()> {
4438
let session = self.ctx.get_current_session();
4539

4640
match plan {

0 commit comments

Comments
 (0)