From 2dc11a2fd037ce2cf5310edf8bb7dffd5a51e7a1 Mon Sep 17 00:00:00 2001 From: Huaijin Date: Tue, 26 Nov 2024 16:47:14 +0800 Subject: [PATCH] fix: sort by time enable in follow (#5151) --- src/service/search/datafusion/table_provider/mod.rs | 4 +++- src/service/search/grpc/flight.rs | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/service/search/datafusion/table_provider/mod.rs b/src/service/search/datafusion/table_provider/mod.rs index 17a15e0631..cd3dca9fd6 100644 --- a/src/service/search/datafusion/table_provider/mod.rs +++ b/src/service/search/datafusion/table_provider/mod.rs @@ -311,7 +311,9 @@ impl TableProvider for NewListingTable { ) } }, - None => {} // no ordering required + None => { + log::debug!("don't not set split_file_groups_by_statistics"); + } // no ordering required }; // extract types of partition columns diff --git a/src/service/search/grpc/flight.rs b/src/service/search/grpc/flight.rs index ee60ae7300..354282b9c9 100644 --- a/src/service/search/grpc/flight.rs +++ b/src/service/search/grpc/flight.rs @@ -100,6 +100,14 @@ pub async fn search( .downcast_ref::() .unwrap(); + // because when init ctx we don't know this information + if empty_exec.sorted_by_time() { + ctx.state_ref().write().config_mut().options_mut().set( + "datafusion.execution.split_file_groups_by_statistics", + "true", + )?; + } + // get stream name let stream_name = empty_exec.name();