Skip to content

Commit 8a2440b

Browse files
authored
Merge pull request #2642 from drmingdrmer/rm-fields
[common/planners] refactor: remove unused fields: TableScanInfo::{table_name, table_args} ScanPlan::table_args
2 parents a7e5cad + d67e548 commit 8a2440b

File tree

8 files changed

+1
-20
lines changed

8 files changed

+1
-20
lines changed

common/planners/src/plan_builder_scan.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,15 @@ use common_datavalues::DataSchemaRef;
1919
use common_datavalues::DataSchemaRefExt;
2020
use common_exception::Result;
2121

22-
use crate::Expression;
2322
use crate::Extras;
2423
use crate::PlanBuilder;
2524
use crate::PlanNode;
2625
use crate::ScanPlan;
2726

2827
pub struct TableScanInfo<'a> {
29-
pub table_name: &'a str,
3028
pub table_id: u64,
3129
pub table_version: Option<u64>,
3230
pub table_schema: &'a DataSchema,
33-
pub table_args: Option<Expression>,
3431
}
3532

3633
impl PlanBuilder {
@@ -58,7 +55,6 @@ impl PlanBuilder {
5855
table_version: table_scan_info.table_version,
5956
table_schema,
6057
projected_schema,
61-
table_args: table_scan_info.table_args,
6258
push_downs: Extras {
6359
projection,
6460
filters: vec![],

common/planners/src/plan_node.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ use crate::StagePlan;
4949
use crate::TruncateTablePlan;
5050
use crate::UseDatabasePlan;
5151

52+
#[allow(clippy::large_enum_variant)]
5253
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq)]
5354
pub enum PlanNode {
5455
Empty(EmptyPlan),

common/planners/src/plan_scan.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use common_datavalues::DataSchemaRef;
1919
use common_meta_types::MetaId;
2020
use common_meta_types::MetaVersion;
2121

22-
use crate::Expression;
2322
use crate::Extras;
2423

2524
#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq)]
@@ -30,7 +29,6 @@ pub struct ScanPlan {
3029
pub table_version: Option<MetaVersion>,
3130
// The schema of the source data
3231
pub table_schema: DataSchemaRef,
33-
pub table_args: Option<Expression>,
3432
pub projected_schema: DataSchemaRef,
3533
// Extras.
3634
pub push_downs: Extras,
@@ -48,7 +46,6 @@ impl ScanPlan {
4846
table_version,
4947
table_schema: Arc::new(DataSchema::empty()),
5048
projected_schema: Arc::new(DataSchema::empty()),
51-
table_args: None,
5249
push_downs: Extras::default(),
5350
}
5451
}
@@ -60,7 +57,6 @@ impl ScanPlan {
6057
table_version: None,
6158
table_schema: Arc::new(DataSchema::empty()),
6259
projected_schema: Arc::new(DataSchema::empty()),
63-
table_args: None,
6460
push_downs: Extras::default(),
6561
}
6662
}

common/planners/src/plan_scan_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ fn test_scan_plan() -> Result<()> {
2626
table_id: 0,
2727
table_version: None,
2828
table_schema: DataSchemaRefExt::create(vec![DataField::new("a", DataType::String, false)]),
29-
table_args: None,
3029
projected_schema: DataSchemaRefExt::create(vec![DataField::new(
3130
"a",
3231
DataType::String,

query/src/datasources/table/csv/csv_table_test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ async fn test_csv_table() -> Result<()> {
6666
table_schema: DataSchemaRefExt::create(vec![]),
6767
table_id: 0,
6868
table_version: None,
69-
table_args: None,
7069
projected_schema: DataSchemaRefExt::create(vec![DataField::new(
7170
"column1",
7271
DataType::UInt64,
@@ -145,7 +144,6 @@ async fn test_csv_table_parse_error() -> Result<()> {
145144
table_id: 0,
146145
table_version: None,
147146
table_schema: DataSchemaRefExt::create(vec![]),
148-
table_args: None,
149147
projected_schema: DataSchemaRefExt::create(vec![DataField::new(
150148
"column2",
151149
DataType::UInt64,

query/src/datasources/table_func/numbers_table_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ async fn test_number_table() -> Result<()> {
3535
table_id: 0,
3636
table_version: None,
3737
table_schema: DataSchemaRefExt::create(vec![]),
38-
table_args: Some(Expression::create_literal(DataValue::UInt64(Some(8)))),
3938
projected_schema: DataSchemaRefExt::create(vec![DataField::new(
4039
"number",
4140
DataType::UInt64,

query/src/optimizers/optimizer_statistics_exact.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,9 @@ impl PlanRewriter for StatisticsExactImpl<'_> {
6767
let table_version = Some(table.get_table_info().ident.version);
6868

6969
let tbl_scan_info = TableScanInfo {
70-
table_name,
7170
table_id,
7271
table_version,
7372
table_schema: &table.schema(),
74-
table_args: None,
7573
};
7674
PlanBuilder::scan(db_name, tbl_scan_info, None, None)
7775
.and_then(|builder| builder.build())

query/src/sql/plan_parser.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,9 @@ impl PlanParser {
722722
let table_version = Some(table.get_table_info().ident.version);
723723

724724
let tbl_scan_info = TableScanInfo {
725-
table_name,
726725
table_id,
727726
table_version,
728727
table_schema: &table.schema(),
729-
table_args: None,
730728
};
731729

732730
PlanBuilder::scan(db_name, tbl_scan_info, None, None)
@@ -761,7 +759,6 @@ impl PlanParser {
761759
db_name = name.0[0].to_string();
762760
table_name = name.0[1].to_string();
763761
}
764-
let table_args = None;
765762
let meta_id;
766763
let meta_version;
767764
let table;
@@ -794,7 +791,6 @@ impl PlanParser {
794791
let table_func = self.ctx.get_table_function(&table_name, Some(table_args))?;
795792
meta_id = table_func.get_id();
796793
meta_version = table_func.get_table_info().ident.version;
797-
table_name = table_func.name().to_string();
798794
table = table_func.as_table();
799795
} else {
800796
table = self.ctx.get_table(&db_name, &table_name)?;
@@ -804,11 +800,9 @@ impl PlanParser {
804800

805801
let scan = {
806802
let tbl_scan_info = TableScanInfo {
807-
table_name: &table_name,
808803
table_id: meta_id,
809804
table_version: Some(meta_version),
810805
table_schema: &table.schema(),
811-
table_args,
812806
};
813807
PlanBuilder::scan(&db_name, tbl_scan_info, None, None)
814808
.and_then(|builder| builder.build())

0 commit comments

Comments
 (0)