diff --git a/server/src/db/chunk.rs b/server/src/db/chunk.rs index b31f9ef9a3..c006ab2ddd 100644 --- a/server/src/db/chunk.rs +++ b/server/src/db/chunk.rs @@ -1,6 +1,7 @@ use super::{ catalog::chunk::ChunkMetadata, pred::to_read_buffer_predicate, streams::ReadFilterResultsStream, }; +use chrono::{DateTime, Utc}; use data_types::partition_metadata; use datafusion::physical_plan::SendableRecordBatchStream; use datafusion_util::MemoryStream; @@ -201,6 +202,20 @@ impl DbChunk { pub fn table_name(&self) -> Arc { Arc::clone(&self.table_name) } + + pub fn time_of_first_write(&self) -> DateTime { + match &self.state { + State::MutableBuffer { chunk } => chunk.table_summary().time_of_first_write, + _ => unimplemented!(), + } + } + + pub fn time_of_last_write(&self) -> DateTime { + match &self.state { + State::MutableBuffer { chunk } => chunk.table_summary().time_of_last_write, + _ => unimplemented!(), + } + } } impl QueryChunk for DbChunk {