Skip to content

Commit

Permalink
opt
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal committed Jul 6, 2024
1 parent 0e9cbb9 commit c4654e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions datafusion/functions/src/core/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn make_map(args: &[ColumnarValue]) -> Result<ColumnarValue> {
}

let string_builder = StringBuilder::new();
let int_builder = Int32Builder::with_capacity(100);
let int_builder = Int32Builder::with_capacity(args.len() / 2);
let mut builder =
MapBuilder::new(None, string_builder, int_builder);

Expand Down Expand Up @@ -134,7 +134,9 @@ mod tests {
let mut key_buffer= VecDeque::new();
let mut value_buffer = VecDeque::new();

for _ in 0..1000 {
let num = 10;
println!("Generating {} random key-value pairs", num);
for _ in 0..num {
let rand: i32 = random();
let key = format!("key_{}", rand.clone());
key_buffer.push_back(key.clone());
Expand Down

0 comments on commit c4654e7

Please sign in to comment.