-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config option for coalesce_batches physical optimization rule, make optional #2791
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,10 @@ use crate::physical_optimizer::coalesce_batches::CoalesceBatches; | |
use crate::physical_optimizer::merge_exec::AddCoalescePartitionsExec; | ||
use crate::physical_optimizer::repartition::Repartition; | ||
|
||
use crate::config::{ConfigOptions, OPT_BATCH_SIZE, OPT_FILTER_NULL_JOIN_KEYS}; | ||
use crate::config::{ | ||
ConfigOptions, OPT_BATCH_SIZE, OPT_COALESCE_BATCHES, OPT_COALESCE_TARGET_BATCH_SIZE, | ||
OPT_FILTER_NULL_JOIN_KEYS, | ||
}; | ||
use crate::execution::runtime_env::{RuntimeConfig, RuntimeEnv}; | ||
use crate::logical_plan::plan::Explain; | ||
use crate::physical_plan::file_format::{plan_to_csv, plan_to_json, plan_to_parquet}; | ||
|
@@ -1247,16 +1250,26 @@ impl SessionState { | |
rules.push(Arc::new(LimitPushDown::new())); | ||
rules.push(Arc::new(SingleDistinctToGroupBy::new())); | ||
|
||
let mut physical_optimizers: Vec<Arc<dyn PhysicalOptimizerRule + Sync + Send>> = vec![ | ||
Arc::new(AggregateStatistics::new()), | ||
Arc::new(HashBuildProbeOrder::new()), | ||
]; | ||
if config.config_options.get_bool(OPT_COALESCE_BATCHES) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it would be helpful to add a test to ensure the option to disable coalsce'ing batches doesn't get broken in the future There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. I will get to this in the next day or two. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added tests for disabling the optimizer rule and also for setting a custom batch size. |
||
physical_optimizers.push(Arc::new(CoalesceBatches::new( | ||
config | ||
.config_options | ||
.get_u64(OPT_COALESCE_TARGET_BATCH_SIZE) | ||
.try_into() | ||
.unwrap(), | ||
))); | ||
} | ||
physical_optimizers.push(Arc::new(Repartition::new())); | ||
physical_optimizers.push(Arc::new(AddCoalescePartitionsExec::new())); | ||
|
||
SessionState { | ||
session_id, | ||
optimizer: Optimizer::new(rules), | ||
physical_optimizers: vec![ | ||
Arc::new(AggregateStatistics::new()), | ||
Arc::new(HashBuildProbeOrder::new()), | ||
Arc::new(CoalesceBatches::new()), | ||
Arc::new(Repartition::new()), | ||
Arc::new(AddCoalescePartitionsExec::new()), | ||
], | ||
physical_optimizers, | ||
query_planner: Arc::new(DefaultQueryPlanner {}), | ||
catalog_list, | ||
scalar_functions: HashMap::new(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,5 @@ pub mod optimizer; | |
pub mod pruning; | ||
pub mod repartition; | ||
mod utils; | ||
|
||
pub use optimizer::PhysicalOptimizerRule; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like how this new option framework is coming together ❤️