From 162a73fd109f3f469bd70fc8b5405948a13c194b Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Tue, 11 Mar 2025 03:32:05 -0400 Subject: [PATCH] update to SessionConfig add `schema_force_view_types=true` in query session config as it improves query performance as explained here - https://github.com/apache/datafusion/pull/13101 --- src/query/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/query/mod.rs b/src/query/mod.rs index 9fb50b94e..df230ef07 100644 --- a/src/query/mod.rs +++ b/src/query/mod.rs @@ -65,7 +65,6 @@ pub static QUERY_SESSION: Lazy = pub static QUERY_RUNTIME: Lazy = Lazy::new(|| Runtime::new().expect("Runtime should be constructible")); - /// This function executes a query on the dedicated runtime, ensuring that the query is not isolated to a single thread/CPU /// at a time and has access to the entire thread pool, enabling better concurrent processing, and thus quicker results. pub async fn execute( @@ -126,6 +125,14 @@ impl Query { .execution .use_row_number_estimates_to_optimize_partitioning = true; + //adding this config as it improves query performance as explained here - + // https://github.com/apache/datafusion/pull/13101 + config + .options_mut() + .execution + .parquet + .schema_force_view_types = true; + let state = SessionStateBuilder::new() .with_default_features() .with_config(config)