Skip to content

Commit 2ea5631

Browse files
andygroveclaude
andcommitted
chore: format code
Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent e32dd52 commit 2ea5631

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

native/core/benches/array_conversion.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
//! Benchmarks for SparkUnsafeArray to Arrow array conversion.
1919
//! This specifically tests the append_to_builder function used in shuffle read path.
2020
21-
use arrow::array::builder::{ArrayBuilder, Int32Builder, Int64Builder, Float64Builder, Date32Builder, TimestampMicrosecondBuilder};
21+
use arrow::array::builder::{
22+
ArrayBuilder, Date32Builder, Float64Builder, Int32Builder, Int64Builder,
23+
TimestampMicrosecondBuilder,
24+
};
2225
use arrow::datatypes::{DataType, TimeUnit};
2326
use comet::execution::shuffle::list::{append_to_builder, SparkUnsafeArray};
2427
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
@@ -48,7 +51,8 @@ fn create_spark_unsafe_array_i32(num_elements: usize, with_nulls: bool) -> Vec<u
4851
let word_idx = i / 64;
4952
let bit_idx = i % 64;
5053
let word_offset = 8 + word_idx * 8;
51-
let current_word = i64::from_le_bytes(buffer[word_offset..word_offset + 8].try_into().unwrap());
54+
let current_word =
55+
i64::from_le_bytes(buffer[word_offset..word_offset + 8].try_into().unwrap());
5256
let new_word = current_word | (1i64 << bit_idx);
5357
buffer[word_offset..word_offset + 8].copy_from_slice(&new_word.to_le_bytes());
5458
}
@@ -81,7 +85,8 @@ fn create_spark_unsafe_array_i64(num_elements: usize, with_nulls: bool) -> Vec<u
8185
let word_idx = i / 64;
8286
let bit_idx = i % 64;
8387
let word_offset = 8 + word_idx * 8;
84-
let current_word = i64::from_le_bytes(buffer[word_offset..word_offset + 8].try_into().unwrap());
88+
let current_word =
89+
i64::from_le_bytes(buffer[word_offset..word_offset + 8].try_into().unwrap());
8590
let new_word = current_word | (1i64 << bit_idx);
8691
buffer[word_offset..word_offset + 8].copy_from_slice(&new_word.to_le_bytes());
8792
}
@@ -114,7 +119,8 @@ fn create_spark_unsafe_array_f64(num_elements: usize, with_nulls: bool) -> Vec<u
114119
let word_idx = i / 64;
115120
let bit_idx = i % 64;
116121
let word_offset = 8 + word_idx * 8;
117-
let current_word = i64::from_le_bytes(buffer[word_offset..word_offset + 8].try_into().unwrap());
122+
let current_word =
123+
i64::from_le_bytes(buffer[word_offset..word_offset + 8].try_into().unwrap());
118124
let new_word = current_word | (1i64 << bit_idx);
119125
buffer[word_offset..word_offset + 8].copy_from_slice(&new_word.to_le_bytes());
120126
}
@@ -193,7 +199,8 @@ fn benchmark_array_conversion(c: &mut Criterion) {
193199
if with_nulls {
194200
append_to_builder::<true>(&DataType::Float64, &mut builder, array).unwrap();
195201
} else {
196-
append_to_builder::<false>(&DataType::Float64, &mut builder, array).unwrap();
202+
append_to_builder::<false>(&DataType::Float64, &mut builder, array)
203+
.unwrap();
197204
}
198205
builder.finish()
199206
});

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ impl SparkUnsafeArray {
101101
/// For non-nullable: uses slice append for optimal performance.
102102
/// For nullable: uses pointer iteration with efficient null bitset reading.
103103
#[inline]
104-
pub(crate) fn append_ints_to_builder<const NULLABLE: bool>(
105-
&self,
106-
builder: &mut Int32Builder,
107-
) {
104+
pub(crate) fn append_ints_to_builder<const NULLABLE: bool>(&self, builder: &mut Int32Builder) {
108105
let num_elements = self.num_elements;
109106
if num_elements == 0 {
110107
return;
@@ -136,10 +133,7 @@ impl SparkUnsafeArray {
136133

137134
/// Bulk append i64 values to builder.
138135
#[inline]
139-
pub(crate) fn append_longs_to_builder<const NULLABLE: bool>(
140-
&self,
141-
builder: &mut Int64Builder,
142-
) {
136+
pub(crate) fn append_longs_to_builder<const NULLABLE: bool>(&self, builder: &mut Int64Builder) {
143137
let num_elements = self.num_elements;
144138
if num_elements == 0 {
145139
return;
@@ -204,10 +198,7 @@ impl SparkUnsafeArray {
204198

205199
/// Bulk append i8 values to builder.
206200
#[inline]
207-
pub(crate) fn append_bytes_to_builder<const NULLABLE: bool>(
208-
&self,
209-
builder: &mut Int8Builder,
210-
) {
201+
pub(crate) fn append_bytes_to_builder<const NULLABLE: bool>(&self, builder: &mut Int8Builder) {
211202
let num_elements = self.num_elements;
212203
if num_elements == 0 {
213204
return;

0 commit comments

Comments
 (0)