From 056c29aaa240a0270f6457259a4244a639db3433 Mon Sep 17 00:00:00 2001 From: Marco Neumann Date: Mon, 3 May 2021 17:09:51 +0200 Subject: [PATCH] feat: add a way to retrieve timestamp range from parquet chunk --- parquet_file/src/chunk.rs | 6 ++++++ parquet_file/src/table.rs | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/parquet_file/src/chunk.rs b/parquet_file/src/chunk.rs index 73145e431f..37074f5c5c 100644 --- a/parquet_file/src/chunk.rs +++ b/parquet_file/src/chunk.rs @@ -146,6 +146,12 @@ impl Chunk { Ok(table.path()) } + /// Return Schema for the specified table / columns + pub fn timestamp_range(&self, table_name: &str) -> Result> { + let table = self.find_table(table_name)?; + Ok(table.timestamp_range()) + } + // Return all tables of this chunk whose timestamp overlaps with the give one pub fn table_names( &self, diff --git a/parquet_file/src/table.rs b/parquet_file/src/table.rs index 5da0887ddf..2bd5828ea9 100644 --- a/parquet_file/src/table.rs +++ b/parquet_file/src/table.rs @@ -96,6 +96,11 @@ impl Table { }) } + /// Return timestamp range of this table + pub fn timestamp_range(&self) -> Option { + self.timestamp_range + } + // Check if 2 time ranges overlap pub fn matches_predicate(&self, timestamp_range: &Option) -> bool { match (self.timestamp_range, timestamp_range) {