This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion-python.git
The following commit(s) were added to refs/heads/master by this push:
new 0ac714a [DataFrame] - Add write_csv/write_parquet/write_json to
DataFrame (#58)
0ac714a is described below
commit 0ac714a62bada4e1441c21b60a05c8bf3db9e31f
Author: Francis Du <[email protected]>
AuthorDate: Thu Oct 13 20:35:46 2022 +0800
[DataFrame] - Add write_csv/write_parquet/write_json to DataFrame (#58)
---
src/dataframe.rs | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/dataframe.rs b/src/dataframe.rs
index c992d10..6a5d1f5 100644
--- a/src/dataframe.rs
+++ b/src/dataframe.rs
@@ -234,4 +234,22 @@ impl PyDataFrame {
let new_df = self.df.except(py_df.df)?;
Ok(Self::new(new_df))
}
+
+ /// Write a `DataFrame` to a CSV file.
+ fn write_csv(&self, path: &str, py: Python) -> PyResult<()> {
+ wait_for_future(py, self.df.write_csv(path))?;
+ Ok(())
+ }
+
+ /// Write a `DataFrame` to a Parquet file.
+ fn write_parquet(&self, path: &str, py: Python) -> PyResult<()> {
+ wait_for_future(py, self.df.write_parquet(path, None))?;
+ 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.write_json(path))?;
+ Ok(())
+ }
}