Skip to content

Commit e2ab61d

Browse files
committed
feat: change into_view method to public and update test for async SQL execution
1 parent 6b76e8f commit e2ab61d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/dataframe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ impl PyDataFrame {
405405
/// https://github.com/apache/datafusion-python/pull/1016#discussion_r1983239116
406406
/// - we have not decided on the table_provider approach yet
407407
#[allow(clippy::wrong_self_convention)]
408-
fn into_view(&self) -> PyDataFusionResult<PyTableProvider> {
408+
pub fn into_view(&self) -> PyDataFusionResult<PyTableProvider> {
409409
// Call the underlying Rust DataFrame::into_view method.
410410
// Note that the Rust method consumes self; here we clone the inner Arc<DataFrame>
411411
// so that we don’t invalidate this PyDataFrame.

tests/dataframe_into_view.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ fn dataframe_into_view_returns_table_provider() {
3030
.unwrap();
3131

3232
let rt = tokio::runtime::Runtime::new().unwrap();
33-
let batches = rt
34-
.block_on(ctx.sql("SELECT * FROM view").unwrap().collect())
35-
.unwrap();
33+
let batches = rt.block_on(async {
34+
let df = ctx.sql("SELECT * FROM view").await.unwrap();
35+
df.collect().await.unwrap()
36+
});
3637

3738
assert_eq!(batches.len(), 1);
3839
assert_eq!(batches[0].num_rows(), 3);

0 commit comments

Comments
 (0)