timsaucer commented on code in PR #23656:
URL: https://github.com/apache/datafusion/pull/23656#discussion_r3683567071
##########
datafusion/datasource/src/sink.rs:
##########
@@ -293,3 +346,200 @@ fn make_count_schema() -> SchemaRef {
false,
)]))
}
+
+#[cfg(test)]
+mod sink_tests {
Review Comment:
```suggestion
mod tests {
```
Nit, but consistent with the repo and rust standard practice.
##########
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:
Since this is being left for future work instead of exposing the metadata
here, can you open an issue to track this and link the comment to the issue?
--
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]