diff --git a/src/mito2/src/access_layer.rs b/src/mito2/src/access_layer.rs index 163d003397..2950ae6a1c 100644 --- a/src/mito2/src/access_layer.rs +++ b/src/mito2/src/access_layer.rs @@ -51,6 +51,7 @@ pub struct Metrics { pub index_update: Duration, pub index_finish: Duration, pub close: Duration, + pub num_series: usize, } impl Metrics { diff --git a/src/mito2/src/sst/parquet/writer.rs b/src/mito2/src/sst/parquet/writer.rs index d6875afafe..b6a4360581 100644 --- a/src/mito2/src/sst/parquet/writer.rs +++ b/src/mito2/src/sst/parquet/writer.rs @@ -163,6 +163,7 @@ where let write_format = WriteFormat::new(self.metadata.clone()).with_override_sequence(override_sequence); let mut stats = SourceStats::default(); + let mut last_key = None; while let Some(res) = self .write_next_batch(&mut source, &write_format, opts, metrics) @@ -171,6 +172,15 @@ where { match res { Ok(mut batch) => { + if let Some(last) = &last_key { + if last != batch.primary_key() { + metrics.num_series += 1; + last_key = Some(batch.primary_key().to_vec()); + } + } else { + metrics.num_series += 1; + } + stats.update(&batch); let index_start = Instant::now(); self.get_or_create_indexer().await.update(&mut batch).await;