Skip to content

Commit a8f0d59

Browse files
authored
bugfix: correct regression on TableType for into_view (#18617)
## Which issue does this PR close? #18158 introduced a regression in the table type created with `DataFrame::into_view()` ## Rationale for this change Correct regression ## What changes are included in this PR? One line fix ## Are these changes tested? Unit test added ## Are there any user-facing changes? None
1 parent 2066568 commit a8f0d59

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

datafusion/core/src/dataframe/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ impl DataFrame {
16551655
pub fn into_view(self) -> Arc<dyn TableProvider> {
16561656
Arc::new(DataFrameTableProvider {
16571657
plan: self.plan,
1658-
table_type: TableType::Temporary,
1658+
table_type: TableType::View,
16591659
})
16601660
}
16611661

datafusion/core/tests/dataframe/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,9 @@ async fn register_table() -> Result<()> {
16271627
let df_impl = DataFrame::new(ctx.state(), df.logical_plan().clone());
16281628

16291629
// register a dataframe as a table
1630-
ctx.register_table("test_table", df_impl.clone().into_view())?;
1630+
let table_provider = df_impl.clone().into_view();
1631+
assert_eq!(table_provider.table_type(), TableType::View);
1632+
ctx.register_table("test_table", table_provider)?;
16311633

16321634
// pull the table out
16331635
let table = ctx.table("test_table").await?;

0 commit comments

Comments
 (0)