From 608dcc26b9b47af57d8c0853b38088544341f215 Mon Sep 17 00:00:00 2001 From: Jia-Xuan Liu Date: Fri, 30 Aug 2024 00:53:46 +0800 Subject: [PATCH] remove pub get method for table scan --- datafusion/expr/src/logical_plan/plan.rs | 20 -------------------- datafusion/sql/src/unparser/plan.rs | 11 ++++++----- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs index cc8349126766..8e6ec762f549 100644 --- a/datafusion/expr/src/logical_plan/plan.rs +++ b/datafusion/expr/src/logical_plan/plan.rs @@ -2401,26 +2401,6 @@ impl TableScan { fetch, }) } - - /// Get the table name - pub fn table_name(&self) -> TableReference { - self.table_name.clone() - } - - /// Get the table source reference - pub fn source(&self) -> Arc { - Arc::clone(&self.source) - } - - /// Get the projection - pub fn projection(&self) -> Option<&[usize]> { - self.projection.as_deref() - } - - /// Get the filters - pub fn filters(&self) -> &[Expr] { - &self.filters - } } /// Apply Cross Join to two logical plans diff --git a/datafusion/sql/src/unparser/plan.rs b/datafusion/sql/src/unparser/plan.rs index 88488faf8b50..3b377bab31e4 100644 --- a/datafusion/sql/src/unparser/plan.rs +++ b/datafusion/sql/src/unparser/plan.rs @@ -24,6 +24,7 @@ use datafusion_expr::{ LogicalPlanBuilder, Projection, SortExpr, }; use sqlparser::ast::{self, Ident, SetExpr}; +use std::sync::Arc; use super::{ ast::{ @@ -530,18 +531,18 @@ impl Unparser<'_> { match plan { LogicalPlan::TableScan(table_scan) => { // TODO: support filters for table scan with alias - if alias.is_some() && !table_scan.filters().is_empty() { + if alias.is_some() && !table_scan.filters.is_empty() { return not_impl_err!( "Subquery alias is not supported for table scan with pushdown filters" ); } let mut builder = LogicalPlanBuilder::scan( - table_scan.table_name(), - table_scan.source(), + table_scan.table_name.clone(), + Arc::clone(&table_scan.source), None, )?; - if let Some(project_vec) = table_scan.projection() { + if let Some(project_vec) = &table_scan.projection { let project_columns = project_vec .iter() .cloned() @@ -562,7 +563,7 @@ impl Unparser<'_> { } let filter_expr = table_scan - .filters() + .filters .iter() .cloned() .reduce(|acc, expr| acc.and(expr));