Skip to content

Conversation

timsaucer
Copy link
Member

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?

Are 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.

@timsaucer timsaucer requested a review from Copilot October 13, 2025 12:08
Copy link
Contributor

@Copilot Copilot AI left a 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 optional temporary 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.

Comment on lines +18 to 32
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;
Copy link

Copilot AI Oct 13, 2025

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.
Copy link

Copilot AI Oct 13, 2025

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.

Suggested change
/// except that it is for temporary tables.
/// except that it is for temporary views.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@milenkovicm milenkovicm left a 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

@timsaucer timsaucer merged commit 030873b into apache:main Oct 15, 2025
16 checks passed
@timsaucer timsaucer deleted the feat/temporary-views branch October 15, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants