Skip to content

Commit d7cd4c0

Browse files
committed
Fix incompatibilities with Datafusion 31.0.0
1 parent a7f715d commit d7cd4c0

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/dataframe.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::{errors::DataFusionError, expr::PyExpr};
2222
use datafusion::arrow::datatypes::Schema;
2323
use datafusion::arrow::pyarrow::{PyArrowType, ToPyArrow};
2424
use datafusion::arrow::util::pretty;
25-
use datafusion::dataframe::DataFrame;
25+
use datafusion::dataframe::{DataFrame, DataFrameWriteOptions};
2626
use datafusion::parquet::basic::{BrotliLevel, Compression, GzipLevel, ZstdLevel};
2727
use datafusion::parquet::file::properties::WriterProperties;
2828
use datafusion::prelude::*;
@@ -305,7 +305,13 @@ impl PyDataFrame {
305305

306306
/// Write a `DataFrame` to a CSV file.
307307
fn write_csv(&self, path: &str, py: Python) -> PyResult<()> {
308-
wait_for_future(py, self.df.as_ref().clone().write_csv(path))?;
308+
wait_for_future(
309+
py,
310+
self.df
311+
.as_ref()
312+
.clone()
313+
.write_csv(path, DataFrameWriteOptions::new(), None),
314+
)?;
309315
Ok(())
310316
}
311317

@@ -357,17 +363,24 @@ impl PyDataFrame {
357363

358364
wait_for_future(
359365
py,
360-
self.df
361-
.as_ref()
362-
.clone()
363-
.write_parquet(path, Option::from(writer_properties)),
366+
self.df.as_ref().clone().write_parquet(
367+
path,
368+
DataFrameWriteOptions::new(),
369+
Option::from(writer_properties),
370+
),
364371
)?;
365372
Ok(())
366373
}
367374

368375
/// Executes a query and writes the results to a partitioned JSON file.
369376
fn write_json(&self, path: &str, py: Python) -> PyResult<()> {
370-
wait_for_future(py, self.df.as_ref().clone().write_json(path))?;
377+
wait_for_future(
378+
py,
379+
self.df
380+
.as_ref()
381+
.clone()
382+
.write_json(path, DataFrameWriteOptions::new()),
383+
)?;
371384
Ok(())
372385
}
373386

0 commit comments

Comments
 (0)