korowa commented on PR #12034:
URL: https://github.com/apache/datafusion/pull/12034#issuecomment-2295305836

   Since this file is produced by 
https://github.com/apache/datafusion/blob/main/docs/source/library-user-guide/using-the-dataframe-api.md#write-dataframe-to-files,
 which is runned by 
[this](https://github.com/apache/datafusion/blob/a91be04ced3746c673788d5da124c6d30009d9ff/datafusion/core/src/lib.rs#L682)
 doctest as
   ```sh
   cargo test --doc 'library_user_guide_dataframe_api'
   ```
   
   won't it be better to replace it with tempdir rather than adding this file 
to gitignore? E.g.
   
   ```rs
   use datafusion::prelude::*;
   use datafusion::error::Result;
   use datafusion::dataframe::DataFrameWriteOptions;
   
   #[tokio::main]
   async fn main() -> Result<()> {
       // Replace with actual target path
       let target_path = tempfile::tempdir()?.path().join("example.parquet");
   
       let ctx = SessionContext::new();
       // read example.csv file into a DataFrame
       let df = ctx.read_csv("tests/data/example.csv", 
CsvReadOptions::new()).await?;
       // stream the contents of the DataFrame to the target file
       df.write_parquet(
           target_path.to_string_lossy().as_ref(),
           DataFrameWriteOptions::new(),
           None, // writer_options
       ).await;
       Ok(())
   }
   ```
   
   or to delete the file in the end of the example, like it's done in other 
doctests, but using tempdir has zero (or close to it) risk that this file will 
be committed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to