feat: Add first/last write time on DbChunk
To eventually be used in collect_rub
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<str> {
Arc::clone(&self.table_name)
}
+
+ pub fn time_of_first_write(&self) -> DateTime<Utc> {
+ match &self.state {
+ State::MutableBuffer { chunk } => chunk.table_summary().time_of_first_write,
+ _ => unimplemented!(),
+ }
+ }
+
+ pub fn time_of_last_write(&self) -> DateTime<Utc> {
+ match &self.state {
+ State::MutableBuffer { chunk } => chunk.table_summary().time_of_last_write,
+ _ => unimplemented!(),
+ }
+ }
}
impl QueryChunk for DbChunk {
