-
Notifications
You must be signed in to change notification settings - Fork 131
feat: add temporary view option for into_view #1267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for creating temporary views in addition to regular views through the DataFrame's into_view()
method. The key enhancement is adding an optional temporary
parameter to control whether the created view should be temporary or permanent.
Key changes:
- Extended the
into_view()
method to accept an optionaltemporary
parameter - Implemented
TempViewTable
struct to handle temporary view functionality - Updated tests to validate both temporary and permanent view creation
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/table.rs | Adds TempViewTable struct and TableProvider implementation for temporary views |
src/dataframe.rs | Updates into_view() method to support temporary parameter and conditional table provider creation |
python/datafusion/dataframe.py | Adds optional temporary parameter to Python into_view() method |
python/tests/test_context.py | Parameterizes existing test to verify both temporary and permanent view functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
use crate::dataframe::PyDataFrame; | ||
use crate::dataset::Dataset; | ||
use crate::utils::table_provider_from_pycapsule; | ||
use arrow::datatypes::SchemaRef; | ||
use arrow::pyarrow::ToPyArrow; | ||
use async_trait::async_trait; | ||
use datafusion::catalog::Session; | ||
use datafusion::common::Column; | ||
use datafusion::datasource::{TableProvider, TableType}; | ||
use datafusion::logical_expr::{Expr, LogicalPlanBuilder, TableProviderFilterPushDown}; | ||
use datafusion::physical_plan::ExecutionPlan; | ||
use datafusion::prelude::DataFrame; | ||
use pyo3::prelude::*; | ||
use std::any::Any; | ||
use std::sync::Arc; |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The import statements have been reorganized but are not in alphabetical order. Consider grouping imports by crate (std, external crates, internal crates) and sorting alphabetically within each group for better maintainability.
Copilot uses AI. Check for mistakes.
} | ||
|
||
/// This is nearly identical to `DataFrameTableProvider` | ||
/// except that it is for temporary tables. |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions 'temporary tables' but the struct is for temporary views. Consider updating the comment to say 'temporary views' for accuracy.
/// except that it is for temporary tables. | |
/// except that it is for temporary views. |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timsaucer not sure if you're looking for a reviewer but it looks good to me
Which issue does this PR close?
None
Rationale for this change
This feature allows for creating temporary views. It is needed for the follow on work in #513
What changes are included in this PR?
.into_view()
on the DataFrame to set if the view should be temporaryTempViewTable
to create a temporary view. This is a copy ofDataFrameTableProvider
from the upstream repo until Enhance DataFrame table provider to support temporary views datafusion#18026 is resolvedAre there any user-facing changes?
No. Existing code will continue to work as is. This only added an optional parameter to the user facing API.