-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: Add memory pool configuration to datafusion-cli
#7424
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
Conversation
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.
Thanks @Weijun-H !
datafusion-cli/src/main.rs
Outdated
| #[clap( | ||
| short = 'm', | ||
| long, | ||
| help = "The memory pool limitation (e.g. '10g'), default to 0", |
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.
| help = "The memory pool limitation (e.g. '10g'), default to 0", | |
| help = "The memory pool limitation (e.g. '10g'), default to None (no limit)", |
datafusion-cli/src/main.rs
Outdated
| let rn_config = | ||
| // set memory pool size | ||
| if let Some(memory_limit) = args.memory_limit { | ||
| let memory_limit = memory_limit[..memory_limit.len() - 1] |
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 think this simply passes 10 (bytes) along to the pool size when -m 10G is passed:
$ RUST_LOG=debug /Users/alamb/Software/target-df/debug/datafusion-cli -m 10g
DataFusion CLI v30.0.0
[2023-08-26T11:06:26Z DEBUG datafusion_execution::memory_pool::pool] Created new GreedyMemoryPool(pool_size=10)I think the pool size should work like this. What do you think?
-m 1000-- set pool size to 1000-m 500m-- set pool size to500 * 1024*1024(500 MB)-m 10G-- set pool size to10 * 1024*1024*1024(10 GB)
datafusion-cli/src/main.rs
Outdated
| help = "Specify the memory pool type 'greedy' or 'fair', default to 'greedy'", | ||
| validator(is_valid_memory_pool_type) | ||
| )] | ||
| mem_pool_type: Option<String>, |
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.
Another, perhaps more ideomatic way to do this, is to define an enum like
| mem_pool_type: Option<String>, | |
| mem_pool_type: Option<PoolType>, |
enum PoolType {
Greedy,
Fair
}
impl FromStr for PoolType {
...
}And then I think clap will do the right thing
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.
Thank you @Weijun-H -- I think this looks great ❤️
Which issue does this PR close?
Closes #7419
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?