tustvold commented on code in PR #1719:
URL: https://github.com/apache/arrow-rs/pull/1719#discussion_r878743074
##########
parquet/src/file/writer.rs:
##########
@@ -92,102 +111,90 @@ pub trait FileWriter {
/// All columns should be written sequentially; the main workflow is:
/// - Request the next column using `next_column` method - this will return
`None` if no
/// more columns are available to write.
-/// - Once done writing a column, close column writer with `close_column`
method - this
-/// will finalise column chunk metadata and update row group metrics.
+/// - Once done writing a column, close column writer with `close`
/// - Once all columns have been written, close row group writer with `close`
method -
/// it will return row group metadata and is no-op on already closed row group.
pub trait RowGroupWriter {
/// Returns the next column writer, if available; otherwise returns `None`.
/// In case of any IO error or Thrift error, or if row group writer has
already been
/// closed returns `Err`.
- ///
- /// To request the next column writer, the previous one must be finalised
and closed
- /// using `close_column`.
- fn next_column(&mut self) -> Result<Option<ColumnWriter>>;
-
- /// Closes column writer that was created using `next_column` method.
- /// This should be called before requesting the next column writer.
- fn close_column(&mut self, column_writer: ColumnWriter) -> Result<()>;
+ fn next_column(&mut self) -> Result<Option<SerializedColumnWriter<'_>>>;
/// Closes this row group writer and returns row group metadata.
/// After calling this method row group writer must not be used.
///
- /// It is recommended to call this method before requesting another row
group, but it
- /// will be closed automatically before returning a new row group.
- ///
/// Can be called multiple times. In subsequent calls will result in no-op
and return
/// already created row group metadata.
fn close(&mut self) -> Result<RowGroupMetaDataPtr>;
}
+/// Callback invoked on closing a column chunk, arguments are:
Review Comment:
We have to move to a callback model as the child writers now mutably borrow
from their parents, and so it would be impossible to keep the current
interface. I also happen to think this is cleaner, you simply close the
ColumnWriter when you are finished, vs passing the ColumnWriter back to the
RowGroupWriter.
--
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]