mustafasrepo commented on code in PR #6526:
URL: https://github.com/apache/arrow-datafusion/pull/6526#discussion_r1218105197
##########
datafusion/core/src/physical_plan/file_format/csv.rs:
##########
@@ -323,6 +328,78 @@ impl FileOpener for CsvOpener {
}
}
+/// A [`FileWriterExt`] that opens a CSV file and yields a [`Box<dyn
AsyncWrite + Unpin + Send>`]
+pub struct CsvWriterOpener {
+ writer_mode: FileWriterMode,
+ object_store: Arc<dyn ObjectStore>,
+ file_compression_type: FileCompressionType,
+}
+
+impl CsvWriterOpener {
+ /// Creates writer/opener for CSV files.
+ pub fn new(
+ writer_mode: FileWriterMode,
+ object_store: Arc<dyn ObjectStore>,
+ file_compression_type: FileCompressionType,
+ ) -> Self {
+ Self {
+ writer_mode,
+ object_store,
+ file_compression_type,
+ }
+ }
+}
+
+#[async_trait]
+impl FileWriterFactory for CsvWriterOpener {
+ async fn create_writer(&self, file_meta: FileMeta) -> Result<Box<dyn
FileWriterExt>> {
+ let object = &file_meta.object_meta;
+ match self.writer_mode {
+ // If the mode is append, call the store's append method and
return a ready poll
+ // with the result wrapped in a custom error type if it fails
Review Comment:
Fixed it
--
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]