From f81932107ca45d788b205242bd850fbdccec5905 Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Sun, 1 Sep 2024 11:11:50 +0530 Subject: [PATCH] fix: query result with hot tier send the reverse sorted order of hot tier file list for datafusion to process --- server/src/hottier.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/hottier.rs b/server/src/hottier.rs index 475a559a3..de45530ad 100644 --- a/server/src/hottier.rs +++ b/server/src/hottier.rs @@ -409,6 +409,9 @@ impl HotTierManager { .get_stream_hot_tier_manifest_for_date(stream, &date) .await?; hot_tier_manifest.files.push(parquet_file.clone()); + hot_tier_manifest + .files + .sort_by_key(|file| file.file_path.clone()); // write the manifest file to the hot tier directory let manifest_path = self .hot_tier_path @@ -501,7 +504,9 @@ impl HotTierManager { .iter() .any(|manifest_file| manifest_file.file_path.eq(&file.file_path)) }); - let remaining_files: Vec = manifest_files + hot_tier_files.sort_unstable_by(|a, b| b.file_path.cmp(&a.file_path)); + + let mut remaining_files: Vec = manifest_files .into_iter() .filter(|manifest_file| { hot_tier_files @@ -509,6 +514,8 @@ impl HotTierManager { .all(|file| !file.file_path.eq(&manifest_file.file_path)) }) .collect(); + remaining_files.sort_unstable_by(|a, b| b.file_path.cmp(&a.file_path)); + Ok((hot_tier_files, remaining_files)) }