qzyu999 commented on code in PR #23656:
URL: https://github.com/apache/datafusion/pull/23656#discussion_r3685230356
##########
datafusion/datasource-parquet/src/sink.rs:
##########
@@ -411,6 +411,37 @@ impl DataSink for ParquetSink {
) -> Result<u64> {
FileSink::write_all(self, data, context).await
}
+
+ fn file_metadata(&self) -> Vec<FileWriteMetadata> {
+ let written = self.written.lock();
+ written
+ .iter()
+ .map(|(path, parquet_meta)| {
+ let row_count: u64 = parquet_meta
+ .file_metadata()
+ .num_rows()
+ .try_into()
+ .unwrap_or(0);
+ let byte_size: u64 = parquet_meta
+ .row_groups()
+ .iter()
+ .map(|rg| {
+ u64::try_from(rg.compressed_size()).unwrap_or(0)
+ })
+ .sum();
+
+ FileWriteMetadata {
+ path: path.to_string(),
+ row_count,
+ byte_size,
+ // Full Parquet metadata is accessible via
ParquetSink::written()
+ // for Rust consumers. Thrift serialization for FFI
consumers can
+ // be added when a concrete use case (e.g. Python via
PyO3) needs it.
+ format_metadata: None,
Review Comment:
Done, opened #24010 to track this. Updated the code comment to link to the
issue as well.
--
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]