Skip to content

Conversation

@Weijun-H
Copy link
Member

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?

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Weijun-H !

#[clap(
short = 'm',
long,
help = "The memory pool limitation (e.g. '10g'), default to 0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
help = "The memory pool limitation (e.g. '10g'), default to 0",
help = "The memory pool limitation (e.g. '10g'), default to None (no limit)",

let rn_config =
// set memory pool size
if let Some(memory_limit) = args.memory_limit {
let memory_limit = memory_limit[..memory_limit.len() - 1]
Copy link
Contributor

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 to 500 * 1024*1024 (500 MB)
  • -m 10G -- set pool size to 10 * 1024*1024*1024 (10 GB)

help = "Specify the memory pool type 'greedy' or 'fair', default to 'greedy'",
validator(is_valid_memory_pool_type)
)]
mem_pool_type: Option<String>,
Copy link
Contributor

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

Suggested change
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

@Weijun-H Weijun-H requested a review from alamb August 28, 2023 05:43
Copy link
Contributor

@alamb alamb left a 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 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add memory pool configuration to datafusion-cli

2 participants