mkleen commented on code in PR #23490:
URL: https://github.com/apache/datafusion/pull/23490#discussion_r3845467414
##########
datafusion/datasource/src/file_sink_config.rs:
##########
@@ -28,13 +28,61 @@ use datafusion_common_runtime::SpawnedTask;
use datafusion_execution::object_store::ObjectStoreUrl;
use datafusion_execution::{SendableRecordBatchStream, TaskContext};
use datafusion_expr::dml::InsertOp;
+use datafusion_physical_plan::metrics::{
+ Count, ExecutionPlanMetricsSet, MetricBuilder, MetricCategory, MetricsSet,
Time,
+};
use async_trait::async_trait;
use object_store::ObjectStore;
#[cfg(feature = "proto")]
mod proto;
+/// Common metrics exposed by file sinks.
+#[derive(Debug)]
+pub struct FileSinkMetrics {
+ metrics: ExecutionPlanMetricsSet,
+}
+
+impl FileSinkMetrics {
+ /// Create a new set of file sink metrics.
+ pub fn new() -> Self {
+ Self {
+ metrics: ExecutionPlanMetricsSet::new(),
+ }
+ }
+
+ /// Create a counter for rows written by one sink execution.
+ pub fn rows_written(&self) -> Count {
+ MetricBuilder::new(&self.metrics)
Review Comment:
I think this is odd crate a new counter in a function and handle that out.
How about we store the `Count`s in the `FileSinkMetrics` ?
--
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]