Skip to content

Commit 49d0c27

Browse files
committed
clippy
1 parent 655c7f4 commit 49d0c27

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

native/core/benches/batch_serde.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ fn create_batch() -> RecordBatch {
7171
}
7272
let array: ArrayRef = Arc::new(array.finish());
7373
let array = Arc::new(array);
74-
RecordBatch::try_new(schema.clone(), vec![array.clone(), array.clone(), array]).unwrap()
74+
RecordBatch::try_new(
75+
schema.clone(),
76+
vec![Arc::clone(&array), Arc::clone(&array), array],
77+
)
78+
.unwrap()
7579
}
7680

7781
fn config() -> Criterion {

native/core/src/execution/shuffle/batch_serde.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn write_batch_fast(batch: &RecordBatch, output: &mut Vec<u8>) -> Result<(),
1616
let field_name = field.name();
1717
let field_name_len = field_name.len();
1818
output.write_all(&field_name_len.to_le_bytes()[..])?;
19-
output.write(field_name.as_str().as_bytes())?;
19+
output.write_all(field_name.as_str().as_bytes())?;
2020

2121
// TODO write field type using FFI_ArrowSchema encoding, assume string for now
2222
}
@@ -38,7 +38,7 @@ pub fn write_batch_fast(batch: &RecordBatch, output: &mut Vec<u8>) -> Result<(),
3838

3939
// write data buffer
4040
// println!("writing data buffer with {buffer_len} bytes");
41-
output.write(buffer)?;
41+
output.write_all(buffer)?;
4242

4343
// write offset buffer length
4444
let offsets = string_array.offsets();
@@ -50,7 +50,7 @@ pub fn write_batch_fast(batch: &RecordBatch, output: &mut Vec<u8>) -> Result<(),
5050
// write offset buffer
5151
let offset_buffer = scalar_buffer.inner().as_slice();
5252
// println!("writing offset buffer with {offset_buffer_len} bytes");
53-
output.write(offset_buffer)?;
53+
output.write_all(offset_buffer)?;
5454
}
5555
_ => todo!(),
5656
}
@@ -203,7 +203,11 @@ mod test {
203203
for i in 0..8192 {
204204
b.append_value(format!("{i}"));
205205
}
206-
let array = Arc::new(b.finish());
207-
RecordBatch::try_new(schema.clone(), vec![array.clone(), array.clone(), array]).unwrap()
206+
let array: ArrayRef = Arc::new(b.finish());
207+
RecordBatch::try_new(
208+
schema.clone(),
209+
vec![Arc::clone(&array), Arc::clone(&array), array],
210+
)
211+
.unwrap()
208212
}
209213
}

0 commit comments

Comments
 (0)