Skip to content

Commit

Permalink
Fix compilation of datafusion-cli on 32bit targets (#10594)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathaniel-daniel authored May 21, 2024
1 parent 4b2652f commit 6a75ba6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions datafusion-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ enum ByteUnit {
}

impl ByteUnit {
fn multiplier(&self) -> usize {
fn multiplier(&self) -> u64 {
match self {
ByteUnit::Byte => 1,
ByteUnit::KiB => 1 << 10,
Expand Down Expand Up @@ -349,8 +349,12 @@ fn extract_memory_pool_size(size: &str) -> Result<usize, String> {
let unit = byte_suffixes()
.get(suffix)
.ok_or_else(|| format!("Invalid memory pool size '{}'", size))?;
let memory_pool_size = usize::try_from(unit.multiplier())
.ok()
.and_then(|multiplier| num.checked_mul(multiplier))
.ok_or_else(|| format!("Memory pool size '{}' is too large", size))?;

Ok(num * unit.multiplier())
Ok(memory_pool_size)
} else {
Err(format!("Invalid memory pool size '{}'", size))
}
Expand Down

0 comments on commit 6a75ba6

Please sign in to comment.