48
48
//! iceberg_writer.write(input).await?;
49
49
//!
50
50
//! let write_result = iceberg_writer.flush().await?;
51
+ //!
52
+ //! let data_file = write_result.into_iter().map(|builder|builder.build()).collect::<Vec<_>>();
51
53
//! ```
52
54
//!
53
55
//! # Complex Case 2: Create a fanout partition data file writer using parquet file format.
65
67
//! iceberg_writer.write(input).await?;
66
68
//!
67
69
//! let write_result = iceberg_writer.flush().await?;
70
+ //!
71
+ //! let data_file = write_result.into_iter().map(|builder|builder.build()).collect::<Vec<_>>();
68
72
//! ```
69
73
70
- use crate :: {
71
- spec:: { DataContentType , Struct } ,
72
- Result ,
73
- } ;
74
+ use crate :: { spec:: DataFileBuilder , Result } ;
74
75
use arrow_array:: RecordBatch ;
75
76
use arrow_schema:: SchemaRef ;
76
77
@@ -90,22 +91,10 @@ pub trait IcebergWriterBuilder<I = DefaultInput>: Send + Clone + 'static {
90
91
/// The iceberg writer used to write data to iceberg table.
91
92
#[ async_trait:: async_trait]
92
93
pub trait IcebergWriter < I = DefaultInput > : Send + ' static {
93
- /// The associated write result type.
94
- type R : IcebergWriteResult ;
95
94
/// Write data to iceberg table.
96
95
async fn write ( & mut self , input : I ) -> Result < ( ) > ;
97
96
/// Flush the writer and return the write result.
98
- async fn flush ( & mut self ) -> Result < Vec < Self :: R > > ;
99
- }
100
-
101
- /// The write result of iceberg writer.
102
- pub trait IcebergWriteResult : Send + Sync + ' static {
103
- /// Set the content type of the write result.
104
- fn set_content ( & mut self , content : DataContentType ) -> & mut Self ;
105
- /// Set the equality ids of the write result.
106
- fn set_equality_ids ( & mut self , equality_ids : Vec < i32 > ) -> & mut Self ;
107
- /// Set the partition of the write result.
108
- fn set_partition ( & mut self , partition_value : Struct ) -> & mut Self ;
97
+ async fn flush ( & mut self ) -> Result < Vec < DataFileBuilder > > ;
109
98
}
110
99
111
100
/// The current file status of iceberg writer. It implement for the writer which write a single
0 commit comments