From 70c354eed6c173c49c757246ec7e989f4c22ee15 Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Fri, 1 Nov 2024 12:10:12 +0800 Subject: [PATCH] fix: the way to retrieve time index column Signed-off-by: Ruihang Xia --- src/query/src/optimizer/windowed_sort.rs | 2 +- src/table/src/table/scan.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/query/src/optimizer/windowed_sort.rs b/src/query/src/optimizer/windowed_sort.rs index 0d3c08bb08..c755d23e16 100644 --- a/src/query/src/optimizer/windowed_sort.rs +++ b/src/query/src/optimizer/windowed_sort.rs @@ -165,7 +165,7 @@ fn fetch_partition_range(input: Arc) -> DataFusionResult() { partition_ranges = Some(region_scan_exec.get_uncollapsed_partition_ranges()); - time_index = region_scan_exec.time_index(); + time_index = Some(region_scan_exec.time_index()); tag_columns = Some(region_scan_exec.tag_columns()); // set distinguish_partition_ranges to true, this is an incorrect workaround diff --git a/src/table/src/table/scan.rs b/src/table/src/table/scan.rs index cc94a054de..0eac7c0c35 100644 --- a/src/table/src/table/scan.rs +++ b/src/table/src/table/scan.rs @@ -146,13 +146,15 @@ impl RegionScanExec { let _ = scanner.prepare(partition_ranges, distinguish_partition_range); } - pub fn time_index(&self) -> Option { + pub fn time_index(&self) -> String { self.scanner .lock() .unwrap() - .schema() - .timestamp_column() - .map(|x| x.name.clone()) + .metadata() + .time_index_column() + .column_schema + .name + .clone() } pub fn tag_columns(&self) -> Vec {