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 {