Skip to content

Commit

Permalink
Fix incompatibilities with Datafusion 31.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
judahrand committed Sep 10, 2023
1 parent a7f715d commit d7cd4c0
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{errors::DataFusionError, expr::PyExpr};
use datafusion::arrow::datatypes::Schema;
use datafusion::arrow::pyarrow::{PyArrowType, ToPyArrow};
use datafusion::arrow::util::pretty;
use datafusion::dataframe::DataFrame;
use datafusion::dataframe::{DataFrame, DataFrameWriteOptions};
use datafusion::parquet::basic::{BrotliLevel, Compression, GzipLevel, ZstdLevel};
use datafusion::parquet::file::properties::WriterProperties;
use datafusion::prelude::*;
Expand Down Expand Up @@ -305,7 +305,13 @@ impl PyDataFrame {

/// Write a `DataFrame` to a CSV file.
fn write_csv(&self, path: &str, py: Python) -> PyResult<()> {
wait_for_future(py, self.df.as_ref().clone().write_csv(path))?;
wait_for_future(
py,
self.df
.as_ref()
.clone()
.write_csv(path, DataFrameWriteOptions::new(), None),
)?;
Ok(())
}

Expand Down Expand Up @@ -357,17 +363,24 @@ impl PyDataFrame {

wait_for_future(
py,
self.df
.as_ref()
.clone()
.write_parquet(path, Option::from(writer_properties)),
self.df.as_ref().clone().write_parquet(
path,
DataFrameWriteOptions::new(),
Option::from(writer_properties),
),
)?;
Ok(())
}

/// Executes a query and writes the results to a partitioned JSON file.
fn write_json(&self, path: &str, py: Python) -> PyResult<()> {
wait_for_future(py, self.df.as_ref().clone().write_json(path))?;
wait_for_future(
py,
self.df
.as_ref()
.clone()
.write_json(path, DataFrameWriteOptions::new()),
)?;
Ok(())
}

Expand Down

0 comments on commit d7cd4c0

Please sign in to comment.