diff --git a/datafusion/common/src/lib.rs b/datafusion/common/src/lib.rs index 636feb21a4898..f18ce737064fb 100644 --- a/datafusion/common/src/lib.rs +++ b/datafusion/common/src/lib.rs @@ -38,7 +38,7 @@ pub use error::{field_not_found, DataFusionError, Result, SchemaError, SharedRes pub use parsers::parse_interval; pub use scalar::{ScalarType, ScalarValue}; pub use stats::{ColumnStatistics, Statistics}; -pub use table_reference::{OwnedTableReference, ResolvedTableReference, TableReference}; +pub use table_reference::{ResolvedTableReference, TableReference}; /// Downcast an Arrow Array to a concrete type, return an `DataFusionError::Internal` if the cast is /// not possible. In normal usage of DataFusion the downcast should always succeed. diff --git a/datafusion/common/src/table_reference.rs b/datafusion/common/src/table_reference.rs index 34656bc114a6d..78c58a0745a84 100644 --- a/datafusion/common/src/table_reference.rs +++ b/datafusion/common/src/table_reference.rs @@ -42,7 +42,7 @@ impl<'a> std::fmt::Display for ResolvedTableReference<'a> { } /// Represents a path to a table that may require further resolution -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum TableReference<'a> { /// An unqualified table reference, e.g. "table" Bare { @@ -67,56 +67,23 @@ pub enum TableReference<'a> { }, } -/// Represents a path to a table that may require further resolution -/// that owns the underlying names -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum OwnedTableReference { - /// An unqualified table reference, e.g. "table" - Bare { - /// The table name - table: String, - }, - /// A partially resolved table reference, e.g. "schema.table" - Partial { - /// The schema containing the table - schema: String, - /// The table name - table: String, - }, - /// A fully resolved table reference, e.g. "catalog.schema.table" - Full { - /// The catalog (aka database) containing the table - catalog: String, - /// The schema containing the table - schema: String, - /// The table name - table: String, - }, -} - -impl OwnedTableReference { - /// Return a `TableReference` view of this `OwnedTableReference` - pub fn as_table_reference(&self) -> TableReference<'_> { +impl<'a> std::fmt::Display for TableReference<'a> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Self::Bare { table } => TableReference::Bare { - table: table.into(), - }, - Self::Partial { schema, table } => TableReference::Partial { - schema: schema.into(), - table: table.into(), - }, + Self::Bare { table } => write!(f, "{table}"), + Self::Partial { schema, table } => { + write!(f, "{schema}.{table}") + } Self::Full { catalog, schema, table, - } => TableReference::Full { - catalog: catalog.into(), - schema: schema.into(), - table: table.into(), - }, + } => write!(f, "{catalog}.{schema}.{table}"), } } +} +impl<'a> TableReference<'a> { /// Retrieve the actual table name, regardless of qualification pub fn table(&self) -> &str { match self { @@ -125,39 +92,48 @@ impl OwnedTableReference { | Self::Bare { table } => table, } } -} -impl std::fmt::Display for OwnedTableReference { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + /// converts this table reference to a new TableReference borrowed from `self` + pub fn as_borrowed<'b: 'a>(&'b self) -> Self { match self { - OwnedTableReference::Bare { table } => write!(f, "{table}"), - OwnedTableReference::Partial { schema, table } => { - write!(f, "{schema}.{table}") - } - OwnedTableReference::Full { - catalog, + Self::Bare { table } => Self::Bare { + table: Cow::from(table.as_ref()), + }, + Self::Partial { schema, table } => Self::Partial { + schema: Cow::from(schema.as_ref()), + table: Cow::from(table.as_ref()), + }, + Self::Full { schema, table, - } => write!(f, "{catalog}.{schema}.{table}"), + catalog, + } => Self::Full { + schema: Cow::from(schema.as_ref()), + table: Cow::from(table.as_ref()), + catalog: Cow::from(catalog.as_ref()), + }, } } -} - -/// Convert `OwnedTableReference` into a `TableReference`. Somewhat -/// awkward to use but 'idiomatic': `(&table_ref).into()` -impl<'a> From<&'a OwnedTableReference> for TableReference<'a> { - fn from(r: &'a OwnedTableReference) -> Self { - r.as_table_reference() - } -} -impl<'a> TableReference<'a> { - /// Retrieve the actual table name, regardless of qualification - pub fn table(&self) -> &str { + /// converts this table reference to an owned table reference (with `'static` lifetime) + pub fn to_owned(&self) -> TableReference<'static> { match self { - Self::Full { table, .. } - | Self::Partial { table, .. } - | Self::Bare { table } => table, + Self::Bare { table } => TableReference::Bare { + table: Cow::from(table.to_string()), + }, + Self::Partial { schema, table } => TableReference::Partial { + table: Cow::from(table.to_string()), + schema: Cow::from(schema.to_string()), + }, + Self::Full { + schema, + table, + catalog, + } => TableReference::Full { + table: Cow::from(table.to_string()), + schema: Cow::from(schema.to_string()), + catalog: Cow::from(catalog.to_string()), + }, } } diff --git a/datafusion/core/src/catalog/listing_schema.rs b/datafusion/core/src/catalog/listing_schema.rs index 32ee9f62ac3d5..5a3913644c2ac 100644 --- a/datafusion/core/src/catalog/listing_schema.rs +++ b/datafusion/core/src/catalog/listing_schema.rs @@ -22,12 +22,13 @@ use crate::datasource::TableProvider; use crate::execution::context::SessionState; use async_trait::async_trait; use datafusion_common::parsers::CompressionTypeVariant; -use datafusion_common::{DFSchema, DataFusionError, OwnedTableReference}; +use datafusion_common::{DFSchema, DataFusionError, TableReference}; use datafusion_expr::CreateExternalTable; use futures::TryStreamExt; use itertools::Itertools; use object_store::ObjectStore; use std::any::Any; +use std::borrow::Cow; use std::collections::{HashMap, HashSet}; use std::path::Path; use std::sync::{Arc, Mutex}; @@ -128,8 +129,8 @@ impl ListingSchemaProvider { if !self.table_exist(table_name) { let table_url = format!("{}/{}", self.authority, table_path); - let name = OwnedTableReference::Bare { - table: table_name.to_string(), + let name = TableReference::Bare { + table: Cow::from(table_name.to_string()), }; let provider = self .factory diff --git a/datafusion/core/src/execution/context.rs b/datafusion/core/src/execution/context.rs index ce20425a5ba1d..96f82c627d52e 100644 --- a/datafusion/core/src/execution/context.rs +++ b/datafusion/core/src/execution/context.rs @@ -83,7 +83,7 @@ use crate::physical_plan::PhysicalPlanner; use crate::variable::{VarProvider, VarType}; use async_trait::async_trait; use chrono::{DateTime, Utc}; -use datafusion_common::{OwnedTableReference, ScalarValue}; +use datafusion_common::ScalarValue; use datafusion_sql::{ parser::DFParser, planner::{ContextProvider, SqlToRel}, @@ -316,19 +316,19 @@ impl SessionContext { or_replace, }) => { let input = Arc::try_unwrap(input).unwrap_or_else(|e| e.as_ref().clone()); - let table = self.table(&name).await; + let table = self.table(name.as_borrowed()).await; match (if_not_exists, or_replace, table) { (true, false, Ok(_)) => self.return_empty_dataframe(), (false, true, Ok(_)) => { - self.deregister_table(&name)?; + self.deregister_table(name.as_borrowed())?; let schema = Arc::new(input.schema().as_ref().into()); let physical = DataFrame::new(self.state(), input); let batches: Vec<_> = physical.collect_partitioned().await?; let table = Arc::new(MemTable::try_new(schema, batches)?); - self.register_table(&name, table)?; + self.register_table(name.as_borrowed(), table)?; self.return_empty_dataframe() } (true, true, Ok(_)) => Err(DataFusionError::Execution( @@ -341,7 +341,7 @@ impl SessionContext { let batches: Vec<_> = physical.collect_partitioned().await?; let table = Arc::new(MemTable::try_new(schema, batches)?); - self.register_table(&name, table)?; + self.register_table(name.as_borrowed(), table)?; self.return_empty_dataframe() } (false, false, Ok(_)) => Err(DataFusionError::Execution(format!( @@ -356,22 +356,22 @@ impl SessionContext { or_replace, definition, }) => { - let view = self.table(&name).await; + let view = self.table(name.as_borrowed()).await; match (or_replace, view) { (true, Ok(_)) => { - self.deregister_table(&name)?; + self.deregister_table(name.as_borrowed())?; let table = Arc::new(ViewTable::try_new((*input).clone(), definition)?); - self.register_table(&name, table)?; + self.register_table(name.as_borrowed(), table)?; self.return_empty_dataframe() } (_, Err(_)) => { let table = Arc::new(ViewTable::try_new((*input).clone(), definition)?); - self.register_table(&name, table)?; + self.register_table(name.as_borrowed(), table)?; self.return_empty_dataframe() } (false, Ok(_)) => Err(DataFusionError::Execution(format!( @@ -383,7 +383,9 @@ impl SessionContext { LogicalPlan::DropTable(DropTable { name, if_exists, .. }) => { - let result = self.find_and_deregister(&name, TableType::Base).await; + let result = self + .find_and_deregister(name.as_borrowed(), TableType::Base) + .await; match (result, if_exists) { (Ok(true), _) => self.return_empty_dataframe(), (_, true) => self.return_empty_dataframe(), @@ -396,7 +398,9 @@ impl SessionContext { LogicalPlan::DropView(DropView { name, if_exists, .. }) => { - let result = self.find_and_deregister(&name, TableType::View).await; + let result = self + .find_and_deregister(name.as_borrowed(), TableType::View) + .await; match (result, if_exists) { (Ok(true), _) => self.return_empty_dataframe(), (_, true) => self.return_empty_dataframe(), @@ -554,7 +558,7 @@ impl SessionContext { &self, cmd: &CreateExternalTable, ) -> Result { - let exist = self.table_exist(&cmd.name)?; + let exist = self.table_exist(cmd.name.as_borrowed())?; if exist { match cmd.if_not_exists { true => return self.return_empty_dataframe(), @@ -569,7 +573,7 @@ impl SessionContext { let table_provider: Arc = self.create_custom_table(cmd).await?; - self.register_table(&cmd.name, table_provider)?; + self.register_table(cmd.name.as_borrowed(), table_provider)?; self.return_empty_dataframe() } @@ -1779,7 +1783,7 @@ impl SessionState { pub fn resolve_table_references( &self, statement: &datafusion_sql::parser::Statement, - ) -> Result> { + ) -> Result>> { use crate::catalog::information_schema::INFORMATION_SCHEMA_TABLES; use datafusion_sql::parser::Statement as DFStatement; use sqlparser::ast::*; @@ -1865,7 +1869,7 @@ impl SessionState { self.config.options.sql_parser.parse_float_as_decimal; for reference in references { let table = reference.table(); - let resolved = self.resolve_table_ref(reference.as_table_reference()); + let resolved = self.resolve_table_ref(reference.as_borrowed()); if let Entry::Vacant(v) = provider.tables.entry(resolved.to_string()) { if let Ok(schema) = self.schema_for_ref(resolved) { if let Some(table) = schema.table(table).await { diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs index f5866d5a96d5a..82c2c99608ea5 100644 --- a/datafusion/expr/src/logical_plan/plan.rs +++ b/datafusion/expr/src/logical_plan/plan.rs @@ -33,8 +33,7 @@ use crate::{ use arrow::datatypes::{DataType, Field, Schema, SchemaRef}; use datafusion_common::parsers::CompressionTypeVariant; use datafusion_common::{ - plan_err, Column, DFSchema, DFSchemaRef, DataFusionError, OwnedTableReference, - ScalarValue, + plan_err, Column, DFSchema, DFSchemaRef, DataFusionError, ScalarValue, TableReference, }; use std::collections::{HashMap, HashSet}; use std::fmt::{self, Debug, Display, Formatter}; @@ -1283,7 +1282,7 @@ pub struct CreateCatalogSchema { #[derive(Clone, PartialEq, Eq, Hash)] pub struct DropTable { /// The table name - pub name: OwnedTableReference, + pub name: TableReference<'static>, /// If the table exists pub if_exists: bool, /// Dummy schema @@ -1294,7 +1293,7 @@ pub struct DropTable { #[derive(Clone, PartialEq, Eq, Hash)] pub struct DropView { /// The view name - pub name: OwnedTableReference, + pub name: TableReference<'static>, /// If the view exists pub if_exists: bool, /// Dummy schema @@ -1570,7 +1569,7 @@ pub struct Union { #[derive(Clone, PartialEq, Eq, Hash)] pub struct CreateMemoryTable { /// The table name - pub name: OwnedTableReference, + pub name: TableReference<'static>, /// The logical plan pub input: Arc, /// Option to not error if table already exists @@ -1583,7 +1582,7 @@ pub struct CreateMemoryTable { #[derive(Clone, PartialEq, Eq, Hash)] pub struct CreateView { /// The table name - pub name: OwnedTableReference, + pub name: TableReference<'static>, /// The logical plan pub input: Arc, /// Option to not error if table already exists @@ -1598,7 +1597,7 @@ pub struct CreateExternalTable { /// The table schema pub schema: DFSchemaRef, /// The table name - pub name: OwnedTableReference, + pub name: TableReference<'static>, /// The physical location pub location: String, /// The file type of physical file @@ -1660,7 +1659,7 @@ impl Display for WriteOp { #[derive(Clone, PartialEq, Eq, Hash)] pub struct DmlStatement { /// The table name - pub table_name: OwnedTableReference, + pub table_name: TableReference<'static>, /// The schema of the table (must align with Rel input) pub table_schema: DFSchemaRef, /// The type of operation to perform diff --git a/datafusion/sql/src/expr/identifier.rs b/datafusion/sql/src/expr/identifier.rs index a581d5f4720de..2afcc4600fade 100644 --- a/datafusion/sql/src/expr/identifier.rs +++ b/datafusion/sql/src/expr/identifier.rs @@ -20,7 +20,7 @@ use crate::planner::{ }; use crate::utils::normalize_ident; use datafusion_common::{ - Column, DFSchema, DataFusionError, OwnedTableReference, Result, ScalarValue, + Column, DFSchema, DataFusionError, Result, ScalarValue, TableReference, }; use datafusion_expr::{Case, Expr, GetIndexedField}; use sqlparser::ast::{Expr as SQLExpr, Ident}; @@ -74,9 +74,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { ids, self.options.enable_ident_normalization, )? { - OwnedTableReference::Partial { schema, table } => (table, schema), - r @ OwnedTableReference::Bare { .. } - | r @ OwnedTableReference::Full { .. } => { + TableReference::Partial { schema, table } => (table, schema), + r @ TableReference::Bare { .. } | r @ TableReference::Full { .. } => { return Err(DataFusionError::Plan(format!( "Unsupported compound identifier '{r:?}'", ))); @@ -88,8 +87,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { Ok(_) => { // found an exact match on a qualified name so this is a table.column identifier Ok(Expr::Column(Column { - relation: Some(relation), - name, + relation: Some(relation.into()), + name: name.into(), })) } Err(_) => { @@ -99,13 +98,13 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { // Access to a field of a column which is a structure, example: SELECT my_struct.key Ok(Expr::GetIndexedField(GetIndexedField::new( Box::new(Expr::Column(field.qualified_column())), - ScalarValue::Utf8(Some(name)), + ScalarValue::Utf8(Some(name.into())), ))) } else { // table.column identifier Ok(Expr::Column(Column { - relation: Some(relation), - name, + relation: Some(relation.into()), + name: name.into(), })) } } diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rs index e9252db9feb6e..b3e9fa422bace 100644 --- a/datafusion/sql/src/planner.rs +++ b/datafusion/sql/src/planner.rs @@ -27,8 +27,8 @@ use sqlparser::ast::{ColumnDef as SQLColumnDef, ColumnOption}; use sqlparser::ast::{DataType as SQLDataType, Ident, ObjectName, TableAlias}; use datafusion_common::config::ConfigOptions; +use datafusion_common::TableReference; use datafusion_common::{field_not_found, DFSchema, DataFusionError, Result}; -use datafusion_common::{OwnedTableReference, TableReference}; use datafusion_expr::logical_plan::{LogicalPlan, LogicalPlanBuilder}; use datafusion_expr::utils::find_column_exprs; use datafusion_expr::TableSource; @@ -327,7 +327,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { pub(crate) fn object_name_to_table_reference( &self, object_name: ObjectName, - ) -> Result { + ) -> Result> { object_name_to_table_reference( object_name, self.options.enable_ident_normalization, @@ -335,7 +335,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { } } -/// Create a [`OwnedTableReference`] after normalizing the specified ObjectName +/// Create a [`TableReference`] after normalizing the specified ObjectName /// /// Examples /// ```text @@ -348,7 +348,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { pub fn object_name_to_table_reference( object_name: ObjectName, enable_normalization: bool, -) -> Result { +) -> Result> { // use destructure to make it clear no fields on ObjectName are ignored let ObjectName(idents) = object_name; idents_to_table_reference(idents, enable_normalization) @@ -358,7 +358,7 @@ pub fn object_name_to_table_reference( pub(crate) fn idents_to_table_reference( idents: Vec, enable_normalization: bool, -) -> Result { +) -> Result> { struct IdentTaker(Vec); /// take the next identifier from the back of idents, panic'ing if /// there are none left @@ -374,21 +374,26 @@ pub(crate) fn idents_to_table_reference( match taker.0.len() { 1 => { let table = taker.take(enable_normalization); - Ok(OwnedTableReference::Bare { table }) + Ok(TableReference::Bare { + table: table.into(), + }) } 2 => { let table = taker.take(enable_normalization); let schema = taker.take(enable_normalization); - Ok(OwnedTableReference::Partial { schema, table }) + Ok(TableReference::Partial { + schema: schema.into(), + table: table.into(), + }) } 3 => { let table = taker.take(enable_normalization); let schema = taker.take(enable_normalization); let catalog = taker.take(enable_normalization); - Ok(OwnedTableReference::Full { - catalog, - schema, - table, + Ok(TableReference::Full { + catalog: catalog.into(), + schema: schema.into(), + table: table.into(), }) } _ => Err(DataFusionError::Plan(format!( diff --git a/datafusion/sql/src/relation/mod.rs b/datafusion/sql/src/relation/mod.rs index 12f5bd6b49fcd..19a278666efb6 100644 --- a/datafusion/sql/src/relation/mod.rs +++ b/datafusion/sql/src/relation/mod.rs @@ -35,10 +35,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { let table_name = table_ref.to_string(); let cte = planner_context.ctes.get(&table_name); ( - match ( - cte, - self.schema_provider.get_table_provider((&table_ref).into()), - ) { + match (cte, self.schema_provider.get_table_provider(table_ref)) { (Some(cte_plan), _) => Ok(cte_plan.clone()), (_, Ok(provider)) => { LogicalPlanBuilder::scan(&table_name, provider, None)?.build() diff --git a/datafusion/sql/src/statement.rs b/datafusion/sql/src/statement.rs index 201cf7a852432..981445358212b 100644 --- a/datafusion/sql/src/statement.rs +++ b/datafusion/sql/src/statement.rs @@ -25,8 +25,8 @@ use crate::utils::normalize_ident; use arrow_schema::DataType; use datafusion_common::parsers::CompressionTypeVariant; use datafusion_common::{ - Column, DFField, DFSchema, DFSchemaRef, DataFusionError, ExprSchema, - OwnedTableReference, Result, TableReference, ToDFSchema, + Column, DFField, DFSchema, DFSchemaRef, DataFusionError, ExprSchema, Result, + TableReference, ToDFSchema, }; use datafusion_expr::expr_rewriter::normalize_col_with_schemas; use datafusion_expr::logical_plan::builder::project; @@ -413,9 +413,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { let DescribeTableStmt { table_name } = statement; let table_ref = self.object_name_to_table_reference(table_name)?; - let table_source = self - .schema_provider - .get_table_provider((&table_ref).into())?; + let table_source = self.schema_provider.get_table_provider(table_ref)?; let schema = table_source.schema(); @@ -463,7 +461,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { let schema = self.build_schema(columns)?; // External tables do not support schemas at the moment, so the name is just a table name - let name = OwnedTableReference::Bare { table: name }; + let name = TableReference::Bare { table: name.into() }; Ok(LogicalPlan::CreateExternalTable(PlanCreateExternalTable { schema: schema.to_dfschema_ref()?, @@ -633,7 +631,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { let table_ref = self.object_name_to_table_reference(table_name.clone())?; let provider = self .schema_provider - .get_table_provider((&table_ref).into())?; + .get_table_provider(table_ref.as_borrowed())?; let schema = (*provider.schema()).clone(); let schema = DFSchema::try_from(schema)?; let scan = @@ -682,10 +680,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { }; // Do a table lookup to verify the table exists - let table_name = self.object_name_to_table_reference(table_name)?; + let table_ref = self.object_name_to_table_reference(table_name)?; let provider = self .schema_provider - .get_table_provider((&table_name).into())?; + .get_table_provider(table_ref.as_borrowed())?; let arrow_schema = (*provider.schema()).clone(); let table_schema = Arc::new(DFSchema::try_from(arrow_schema)?); let values = table_schema.fields().iter().map(|f| { @@ -769,7 +767,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { let source = project(source, exprs)?; let plan = LogicalPlan::Dml(DmlStatement { - table_name, + table_name: table_ref, table_schema, op: WriteOp::Update, input: Arc::new(source), @@ -784,10 +782,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { source: Box, ) -> Result { // Do a table lookup to verify the table exists - let table_name = self.object_name_to_table_reference(table_name)?; + let table_ref = self.object_name_to_table_reference(table_name)?; let provider = self .schema_provider - .get_table_provider((&table_name).into())?; + .get_table_provider(table_ref.as_borrowed())?; let arrow_schema = (*provider.schema()).clone(); let table_schema = DFSchema::try_from(arrow_schema)?; @@ -858,7 +856,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { let source = project(source, exprs)?; let plan = LogicalPlan::Dml(DmlStatement { - table_name, + table_name: table_ref, table_schema: Arc::new(table_schema), op: WriteOp::Insert, input: Arc::new(source), @@ -893,9 +891,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { // Do a table lookup to verify the table exists let table_ref = self.object_name_to_table_reference(sql_table_name)?; - let _ = self - .schema_provider - .get_table_provider((&table_ref).into())?; + let _ = self.schema_provider.get_table_provider(table_ref)?; // treat both FULL and EXTENDED as the same let select_list = if full || extended { @@ -931,9 +927,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { // Do a table lookup to verify the table exists let table_ref = self.object_name_to_table_reference(sql_table_name)?; - let _ = self - .schema_provider - .get_table_provider((&table_ref).into())?; + let _ = self.schema_provider.get_table_provider(table_ref)?; let query = format!( "SELECT table_catalog, table_schema, table_name, definition FROM information_schema.views WHERE {where_clause}" @@ -946,12 +940,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { /// Return true if there is a table provider available for "schema.table" fn has_table(&self, schema: &str, table: &str) -> bool { - let tables_reference = TableReference::Partial { + let table_ref = TableReference::Partial { schema: schema.into(), table: table.into(), }; - self.schema_provider - .get_table_provider(tables_reference) - .is_ok() + self.schema_provider.get_table_provider(table_ref).is_ok() } }