Apache DataFusion SQL Query Engine
bugfix: correct regression on TableType for into_view (#18617)
Tim Saucera8f0d59de3ce
diff --git a/datafusion/core/src/dataframe/mod.rs b/datafusion/core/src/dataframe/mod.rsindex 98804e424b..b43c9c671f 100644--- a/datafusion/core/src/dataframe/mod.rs+++ b/datafusion/core/src/dataframe/mod.rs@@ -1655,7 +1655,7 @@ impl DataFrame {pub fn into_view(self) -> Arc<dyn TableProvider> {Arc::new(DataFrameTableProvider {plan: self.plan,- table_type: TableType::Temporary,+ table_type: TableType::View,})}diff --git a/datafusion/core/tests/dataframe/mod.rs b/datafusion/core/tests/dataframe/mod.rsindex aab51efa1e..4a49dfb2ed 100644--- a/datafusion/core/tests/dataframe/mod.rs+++ b/datafusion/core/tests/dataframe/mod.rs@@ -1627,7 +1627,9 @@ async fn register_table() -> Result<()> {let df_impl = DataFrame::new(ctx.state(), df.logical_plan().clone());// register a dataframe as a table- ctx.register_table("test_table", df_impl.clone().into_view())?;+ let table_provider = df_impl.clone().into_view();+ assert_eq!(table_provider.table_type(), TableType::View);+ ctx.register_table("test_table", table_provider)?;// pull the table outlet table = ctx.table("test_table").await?;