Skip to content

Commit

Permalink
Cleanup how datafusion session config is created
Browse files Browse the repository at this point in the history
  • Loading branch information
psvri committed Apr 19, 2024
1 parent c698d82 commit 16d7e2c
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions core/src/execution/jni_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,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 16d7e2c

Please sign in to comment.