Skip to content

Commit

Permalink
Chore: Cleanup how datafusion session config is created (apache#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
psvri authored and Steve Vaughan Jr committed Apr 21, 2024
1 parent 1e28bf3 commit c3432be
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions core/src/execution/jni_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,11 @@ fn prepare_datafusion_session_context(
// Get Datafusion configuration from Spark Execution context
// can be configured in Comet Spark JVM using Spark --conf parameters
// e.g: spark-shell --conf spark.datafusion.sql_parser.parse_float_as_decimal=true
let df_config = conf
.iter()
.filter(|(k, _)| k.starts_with("datafusion."))
.map(|kv| (kv.0.to_owned(), kv.1.to_owned()))
.collect::<Vec<(String, String)>>();

let session_config =
SessionConfig::from_string_hash_map(std::collections::HashMap::from_iter(df_config))?
.with_batch_size(batch_size);
let mut session_config = SessionConfig::new().with_batch_size(batch_size);

for (key, value) in conf.iter().filter(|(k, _)| k.starts_with("datafusion.")) {
session_config = session_config.set_str(key, value);
}

let runtime = RuntimeEnv::new(rt_config).unwrap();

Expand Down

0 comments on commit c3432be

Please sign in to comment.