You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by ag...@apache.org on 2025/06/26 23:06:54 UTC
(datafusion-comet) branch main updated: chore: Clippy fixes for Rust 1.88 (#1939)
This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new 32ac26924 chore: Clippy fixes for Rust 1.88 (#1939)
32ac26924 is described below
commit 32ac26924bc23298dce229ace448977d5f0fc012
Author: Andy Grove <ag...@apache.org>
AuthorDate: Thu Jun 26 17:06:49 2025 -0600
chore: Clippy fixes for Rust 1.88 (#1939)
---
native/core/benches/bit_util.rs | 14 ++--
native/core/src/common/bit.rs | 27 +++-----
native/core/src/common/buffer.rs | 6 +-
native/core/src/errors.rs | 10 +--
native/core/src/execution/memory_pools/config.rs | 6 +-
.../core/src/execution/memory_pools/fair_pool.rs | 2 +-
.../src/execution/memory_pools/unified_pool.rs | 4 +-
native/core/src/execution/operators/expand.rs | 2 +-
native/core/src/execution/operators/scan.rs | 7 +-
native/core/src/execution/planner.rs | 41 +++++-------
native/core/src/execution/shuffle/codec.rs | 4 +-
native/core/src/execution/shuffle/list.rs | 7 +-
native/core/src/execution/shuffle/map.rs | 9 +--
native/core/src/execution/shuffle/row.rs | 4 +-
.../core/src/execution/shuffle/shuffle_writer.rs | 20 +++---
native/core/src/execution/tracing.rs | 2 +-
.../core/src/execution/util/spark_bloom_filter.rs | 3 +-
native/core/src/jvm_bridge/mod.rs | 6 +-
native/core/src/lib.rs | 2 +-
native/core/src/parquet/mutable_vector.rs | 2 +-
native/core/src/parquet/objectstore/s3.rs | 76 +++++++++-------------
native/core/src/parquet/read/column.rs | 15 ++---
native/core/src/parquet/read/values.rs | 12 ++--
native/core/src/parquet/util/jni.rs | 8 +--
.../core/src/parquet/util/test_common/page_util.rs | 2 +-
native/hdfs/src/object_store/hdfs.rs | 4 +-
native/spark-expr/src/array_funcs/array_insert.rs | 9 +--
.../src/array_funcs/get_array_struct_fields.rs | 12 ++--
native/spark-expr/src/array_funcs/list_extract.rs | 9 +--
.../src/datetime_funcs/date_arithmetic.rs | 6 +-
native/spark-expr/src/kernels/strings.rs | 7 +-
native/spark-expr/src/kernels/temporal.rs | 12 ++--
native/spark-expr/src/math_funcs/ceil.rs | 3 +-
native/spark-expr/src/math_funcs/floor.rs | 3 +-
native/spark-expr/src/math_funcs/hex.rs | 2 +-
.../src/math_funcs/internal/checkoverflow.rs | 6 +-
.../src/math_funcs/internal/normalize_nan.rs | 2 +-
.../spark-expr/src/nondetermenistic_funcs/rand.rs | 3 +-
native/spark-expr/src/predicate_funcs/is_nan.rs | 3 +-
native/spark-expr/src/predicate_funcs/rlike.rs | 2 +-
.../src/struct_funcs/get_struct_field.rs | 6 +-
native/spark-expr/src/timezone.rs | 5 +-
42 files changed, 154 insertions(+), 231 deletions(-)
diff --git a/native/core/benches/bit_util.rs b/native/core/benches/bit_util.rs
index afffc0d2a..10d706013 100644
--- a/native/core/benches/bit_util.rs
+++ b/native/core/benches/bit_util.rs
@@ -92,7 +92,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for num_bytes in (1..=size_of::<u8>()).step_by(3) {
let x = num_bytes;
group.bench_with_input(
- BenchmarkId::new("get_aligned", format!("u8_num_bytes_{}", x)),
+ BenchmarkId::new("get_aligned", format!("u8_num_bytes_{x}")),
&x,
|b, &x| {
let mut reader: BitReader = BitReader::new_all(buffer.slice(0));
@@ -103,7 +103,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for num_bytes in (1..=size_of::<u32>()).step_by(3) {
let x = num_bytes;
group.bench_with_input(
- BenchmarkId::new("get_aligned", format!("u32_num_bytes_{}", x)),
+ BenchmarkId::new("get_aligned", format!("u32_num_bytes_{x}")),
&x,
|b, &x| {
let mut reader: BitReader = BitReader::new_all(buffer.slice(0));
@@ -114,7 +114,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for num_bytes in (1..=size_of::<i32>()).step_by(3) {
let x = num_bytes;
group.bench_with_input(
- BenchmarkId::new("get_aligned", format!("i32_num_bytes_{}", x)),
+ BenchmarkId::new("get_aligned", format!("i32_num_bytes_{x}")),
&x,
|b, &x| {
let mut reader: BitReader = BitReader::new_all(buffer.slice(0));
@@ -127,7 +127,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for num_bytes in (1..=size_of::<i32>()).step_by(3) {
let x = num_bytes * 8;
group.bench_with_input(
- BenchmarkId::new("get_value", format!("i32_num_bits_{}", x)),
+ BenchmarkId::new("get_value", format!("i32_num_bits_{x}")),
&x,
|b, &x| {
let mut reader: BitReader = BitReader::new_all(buffer.slice(0));
@@ -140,7 +140,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for num_bytes in (1..=8).step_by(7) {
let x = num_bytes;
group.bench_with_input(
- BenchmarkId::new("read_num_bytes_u64", format!("num_bytes_{}", x)),
+ BenchmarkId::new("read_num_bytes_u64", format!("num_bytes_{x}")),
&x,
|b, &x| {
b.iter(|| read_num_bytes_u64(black_box(x), black_box(buffer.as_slice())));
@@ -152,7 +152,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for num_bytes in (1..=4).step_by(3) {
let x = num_bytes;
group.bench_with_input(
- BenchmarkId::new("read_num_bytes_u32", format!("num_bytes_{}", x)),
+ BenchmarkId::new("read_num_bytes_u32", format!("num_bytes_{x}")),
&x,
|b, &x| {
b.iter(|| read_num_bytes_u32(black_box(x), black_box(buffer.as_slice())));
@@ -164,7 +164,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for length in (0..=64).step_by(32) {
let x = length;
group.bench_with_input(
- BenchmarkId::new("trailing_bits", format!("num_bits_{}", x)),
+ BenchmarkId::new("trailing_bits", format!("num_bits_{x}")),
&x,
|b, &x| {
b.iter(|| trailing_bits(black_box(1234567890), black_box(x)));
diff --git a/native/core/src/common/bit.rs b/native/core/src/common/bit.rs
index 17bbb2998..9a444cb60 100644
--- a/native/core/src/common/bit.rs
+++ b/native/core/src/common/bit.rs
@@ -954,8 +954,7 @@ impl BitReader {
shift += 7;
debug_assert!(
shift <= MAX_VLQ_BYTE_LEN * 7,
- "Num of bytes exceed MAX_VLQ_BYTE_LEN ({})",
- MAX_VLQ_BYTE_LEN
+ "Num of bytes exceed MAX_VLQ_BYTE_LEN ({MAX_VLQ_BYTE_LEN})"
);
if likely(byte & 0x80 == 0) {
return Some(v);
@@ -1326,8 +1325,7 @@ mod tests {
(0..total).for_each(|i| {
assert!(
writer.put_value(values[i], num_bits),
- "[{}]: put_value() failed",
- i
+ "[{i}]: put_value() failed"
);
});
@@ -1479,8 +1477,7 @@ mod tests {
for i in 0..batch.len() {
assert_eq!(
batch[i], expected_values[i],
- "num_bits = {}, index = {}",
- num_bits, i
+ "num_bits = {num_bits}, index = {i}"
);
}
}
@@ -1509,11 +1506,7 @@ mod tests {
reader.get_u32_batch(batch.as_mut_ptr(), *total, num_bits);
}
for i in 0..batch.len() {
- assert_eq!(
- batch[i], values[i],
- "num_bits = {}, index = {}",
- num_bits, i
- );
+ assert_eq!(batch[i], values[i], "num_bits = {num_bits}, index = {i}");
}
}
}
@@ -1554,14 +1547,12 @@ mod tests {
if i % 2 == 0 {
assert!(
writer.put_value(values[j] as u64, num_bits),
- "[{}]: put_value() failed",
- i
+ "[{i}]: put_value() failed"
);
} else {
assert!(
writer.put_aligned::<T>(aligned_values[j], aligned_value_byte_width),
- "[{}]: put_aligned() failed",
- i
+ "[{i}]: put_aligned() failed"
);
}
}
@@ -1599,8 +1590,7 @@ mod tests {
(0..total).for_each(|i| {
assert!(
writer.put_vlq_int(values[i] as u64),
- "[{}]; put_vlq_int() failed",
- i
+ "[{i}]; put_vlq_int() failed"
);
});
@@ -1625,8 +1615,7 @@ mod tests {
(0..total).for_each(|i| {
assert!(
writer.put_zigzag_vlq_int(values[i] as i64),
- "[{}]; put_zigzag_vlq_int() failed",
- i
+ "[{i}]; put_zigzag_vlq_int() failed"
);
});
diff --git a/native/core/src/common/buffer.rs b/native/core/src/common/buffer.rs
index 291082d10..b78c0db76 100644
--- a/native/core/src/common/buffer.rs
+++ b/native/core/src/common/buffer.rs
@@ -75,14 +75,12 @@ impl CometBuffer {
assert_eq!(
capacity % ALIGNMENT,
0,
- "input buffer is not aligned to {} bytes",
- ALIGNMENT
+ "input buffer is not aligned to {ALIGNMENT} bytes"
);
Self {
data: NonNull::new(ptr as *mut u8).unwrap_or_else(|| {
panic!(
- "cannot create CometBuffer from (ptr: {:?}, len: {}, capacity: {}",
- ptr, len, capacity
+ "cannot create CometBuffer from (ptr: {ptr:?}, len: {len}, capacity: {capacity}"
)
}),
len,
diff --git a/native/core/src/errors.rs b/native/core/src/errors.rs
index 542649262..b3241477b 100644
--- a/native/core/src/errors.rs
+++ b/native/core/src/errors.rs
@@ -439,7 +439,7 @@ enum StacktraceError {
fn to_stacktrace_string(msg: String, backtrace_string: String) -> Result<String, StacktraceError> {
let mut res = String::new();
- write!(&mut res, "{}", msg).map_err(|error| StacktraceError::Message(error.to_string()))?;
+ write!(&mut res, "{msg}").map_err(|error| StacktraceError::Message(error.to_string()))?;
// Use multi-line mode and named capture groups to identify the following stacktrace fields:
// - dc = declaredClass
@@ -547,9 +547,9 @@ mod tests {
.option("-Xcheck:jni")
.option(class_path.as_str())
.build()
- .unwrap_or_else(|e| panic!("{:#?}", e));
+ .unwrap_or_else(|e| panic!("{e:#?}"));
- let jvm = JavaVM::new(jvm_args).unwrap_or_else(|e| panic!("{:#?}", e));
+ let jvm = JavaVM::new(jvm_args).unwrap_or_else(|e| panic!("{e:#?}"));
#[allow(static_mut_refs)]
unsafe {
@@ -769,7 +769,7 @@ mod tests {
.into();
let output = env
- .new_string(format!("Hello, {}!", input))
+ .new_string(format!("Hello, {input}!"))
.expect("Couldn't create java string!");
Ok(output.into_raw())
@@ -869,7 +869,7 @@ mod tests {
.unwrap();
let message_string = message.into();
let msg_rust: String = env.get_string(&message_string).unwrap().into();
- println!("{}", msg_rust);
+ println!("{msg_rust}");
// Since panics result in multi-line messages which include the backtrace, just use the
// first line.
assert_starts_with!(msg_rust, expected_message);
diff --git a/native/core/src/execution/memory_pools/config.rs b/native/core/src/execution/memory_pools/config.rs
index cd93ea046..f9a0e23f4 100644
--- a/native/core/src/execution/memory_pools/config.rs
+++ b/native/core/src/execution/memory_pools/config.rs
@@ -71,8 +71,7 @@ pub(crate) fn parse_memory_pool_config(
}
_ => {
return Err(CometError::Config(format!(
- "Unsupported memory pool type for off-heap mode: {}",
- memory_pool_type
+ "Unsupported memory pool type for off-heap mode: {memory_pool_type}"
)))
}
}
@@ -95,8 +94,7 @@ pub(crate) fn parse_memory_pool_config(
"unbounded" => MemoryPoolConfig::new(MemoryPoolType::Unbounded, 0),
_ => {
return Err(CometError::Config(format!(
- "Unsupported memory pool type for on-heap mode: {}",
- memory_pool_type
+ "Unsupported memory pool type for on-heap mode: {memory_pool_type}"
)))
}
}
diff --git a/native/core/src/execution/memory_pools/fair_pool.rs b/native/core/src/execution/memory_pools/fair_pool.rs
index bf6133c6d..a4ec83d82 100644
--- a/native/core/src/execution/memory_pools/fair_pool.rs
+++ b/native/core/src/execution/memory_pools/fair_pool.rs
@@ -120,7 +120,7 @@ impl MemoryPool for CometFairMemoryPool {
panic!("Failed to release {subtractive} bytes where only {size} bytes reserved")
}
self.release(subtractive)
- .unwrap_or_else(|_| panic!("Failed to release {} bytes", subtractive));
+ .unwrap_or_else(|_| panic!("Failed to release {subtractive} bytes"));
state.used = state.used.checked_sub(subtractive).unwrap();
}
}
diff --git a/native/core/src/execution/memory_pools/unified_pool.rs b/native/core/src/execution/memory_pools/unified_pool.rs
index 4c6790bdf..8712200d6 100644
--- a/native/core/src/execution/memory_pools/unified_pool.rs
+++ b/native/core/src/execution/memory_pools/unified_pool.rs
@@ -80,7 +80,7 @@ impl Drop for CometMemoryPool {
fn drop(&mut self) {
let used = self.used.load(Relaxed);
if used != 0 {
- log::warn!("CometMemoryPool dropped with {} bytes still reserved", used);
+ log::warn!("CometMemoryPool dropped with {used} bytes still reserved");
}
}
}
@@ -95,7 +95,7 @@ impl MemoryPool for CometMemoryPool {
fn shrink(&self, _: &MemoryReservation, size: usize) {
self.release(size)
- .unwrap_or_else(|_| panic!("Failed to release {} bytes", size));
+ .unwrap_or_else(|_| panic!("Failed to release {size} bytes"));
self.used.fetch_sub(size, Relaxed);
}
diff --git a/native/core/src/execution/operators/expand.rs b/native/core/src/execution/operators/expand.rs
index a34299356..19ca20459 100644
--- a/native/core/src/execution/operators/expand.rs
+++ b/native/core/src/execution/operators/expand.rs
@@ -77,7 +77,7 @@ impl DisplayAs for ExpandExec {
for projection in &self.projections {
write!(f, "[")?;
for expr in projection {
- write!(f, "{}, ", expr)?;
+ write!(f, "{expr}, ")?;
}
write!(f, "], ")?;
}
diff --git a/native/core/src/execution/operators/scan.rs b/native/core/src/execution/operators/scan.rs
index c94c2be37..a842efaa3 100644
--- a/native/core/src/execution/operators/scan.rs
+++ b/native/core/src/execution/operators/scan.rs
@@ -210,8 +210,7 @@ impl ScanExec {
if iter.is_null() {
return Err(CometError::from(ExecutionError::GeneralError(format!(
- "Null batch iterator object. Plan id: {}",
- exec_context_id
+ "Null batch iterator object. Plan id: {exec_context_id}"
))));
}
@@ -303,14 +302,14 @@ fn scan_schema(input_batch: &InputBatch, data_types: &[DataType]) -> SchemaRef {
.map(|(idx, c)| {
let datatype = ScanExec::unpack_dictionary_type(c.data_type());
// We don't use the field name. Put a placeholder.
- Field::new(format!("col_{}", idx), datatype, true)
+ Field::new(format!("col_{idx}"), datatype, true)
})
.collect::<Vec<Field>>()
}
_ => data_types
.iter()
.enumerate()
- .map(|(idx, dt)| Field::new(format!("col_{}", idx), dt.clone(), true))
+ .map(|(idx, dt)| Field::new(format!("col_{idx}"), dt.clone(), true))
.collect(),
};
diff --git a/native/core/src/execution/planner.rs b/native/core/src/execution/planner.rs
index 0ce1ea7a9..a45036be4 100644
--- a/native/core/src/execution/planner.rs
+++ b/native/core/src/execution/planner.rs
@@ -323,8 +323,7 @@ impl PhysicalPlanner {
let idx = bound.index as usize;
if idx >= input_schema.fields().len() {
return Err(GeneralError(format!(
- "Column index {} is out of bound. Schema: {}",
- idx, input_schema
+ "Column index {idx} is out of bound. Schema: {input_schema}"
)));
}
let field = input_schema.field(idx);
@@ -382,7 +381,7 @@ impl PhysicalPlanner {
DataType::List(f) => DataType::List(f).try_into()?,
DataType::Null => ScalarValue::Null,
dt => {
- return Err(GeneralError(format!("{:?} is not supported in Comet", dt)))
+ return Err(GeneralError(format!("{dt:?} is not supported in Comet")))
}
}
} else {
@@ -395,8 +394,7 @@ impl PhysicalPlanner {
DataType::Date32 => ScalarValue::Date32(Some(*value)),
dt => {
return Err(GeneralError(format!(
- "Expected either 'Int32' or 'Date32' for IntVal, but found {:?}",
- dt
+ "Expected either 'Int32' or 'Date32' for IntVal, but found {dt:?}"
)))
}
},
@@ -410,8 +408,7 @@ impl PhysicalPlanner {
}
dt => {
return Err(GeneralError(format!(
- "Expected either 'Int64' or 'Timestamp' for LongVal, but found {:?}",
- dt
+ "Expected either 'Int64' or 'Timestamp' for LongVal, but found {dt:?}"
)))
}
},
@@ -423,8 +420,7 @@ impl PhysicalPlanner {
let big_integer = BigInt::from_signed_bytes_be(value);
let integer = big_integer.to_i128().ok_or_else(|| {
GeneralError(format!(
- "Cannot parse {:?} as i128 for Decimal literal",
- big_integer
+ "Cannot parse {big_integer:?} as i128 for Decimal literal"
))
})?;
@@ -434,8 +430,7 @@ impl PhysicalPlanner {
}
dt => {
return Err(GeneralError(format!(
- "Decimal literal's data type should be Decimal128 but got {:?}",
- dt
+ "Decimal literal's data type should be Decimal128 but got {dt:?}"
)))
}
}
@@ -808,7 +803,7 @@ impl PhysicalPlanner {
let child = self.create_expr(expr.child.as_ref().unwrap(), input_schema)?;
Ok(Arc::new(RandExpr::new(child, self.partition)))
}
- expr => Err(GeneralError(format!("Not implemented: {:?}", expr))),
+ expr => Err(GeneralError(format!("Not implemented: {expr:?}"))),
}
}
@@ -834,7 +829,7 @@ impl PhysicalPlanner {
options,
})
}
- expr => Err(GeneralError(format!("{:?} isn't a SortOrder", expr))),
+ expr => Err(GeneralError(format!("{expr:?} isn't a SortOrder"))),
}
}
@@ -974,7 +969,7 @@ impl PhysicalPlanner {
.enumerate()
.map(|(idx, expr)| {
self.create_expr(expr, child.schema())
- .map(|r| (r, format!("col_{}", idx)))
+ .map(|r| (r, format!("col_{idx}")))
})
.collect();
let projection = Arc::new(ProjectionExec::try_new(
@@ -1019,7 +1014,7 @@ impl PhysicalPlanner {
.enumerate()
.map(|(idx, expr)| {
self.create_expr(expr, child.schema())
- .map(|r| (r, format!("col_{}", idx)))
+ .map(|r| (r, format!("col_{idx}")))
})
.collect();
let group_by = PhysicalGroupBy::new_single(group_exprs?);
@@ -1055,7 +1050,7 @@ impl PhysicalPlanner {
.enumerate()
.map(|(idx, expr)| {
self.create_expr(expr, aggregate.schema())
- .map(|r| (r, format!("col_{}", idx)))
+ .map(|r| (r, format!("col_{idx}")))
})
.collect();
@@ -1338,7 +1333,7 @@ impl PhysicalPlanner {
let fields: Vec<Field> = datatypes
.iter()
.enumerate()
- .map(|(idx, dt)| Field::new(format!("col_{}", idx), dt.clone(), true))
+ .map(|(idx, dt)| Field::new(format!("col_{idx}"), dt.clone(), true))
.collect();
let schema = Arc::new(Schema::new(fields));
@@ -1585,8 +1580,7 @@ impl PhysicalPlanner {
Ok(JoinType::RightAnti) => DFJoinType::RightAnti,
Err(_) => {
return Err(GeneralError(format!(
- "Unsupported join type: {:?}",
- join_type
+ "Unsupported join type: {join_type:?}"
)));
}
};
@@ -1914,8 +1908,7 @@ impl PhysicalPlanner {
)
}
stats_type => Err(GeneralError(format!(
- "Unknown StatisticsType {:?} for Variance",
- stats_type
+ "Unknown StatisticsType {stats_type:?} for Variance"
))),
}
}
@@ -1944,8 +1937,7 @@ impl PhysicalPlanner {
Self::create_aggr_func_expr("variance_pop", schema, vec![child], func)
}
stats_type => Err(GeneralError(format!(
- "Unknown StatisticsType {:?} for Variance",
- stats_type
+ "Unknown StatisticsType {stats_type:?} for Variance"
))),
}
}
@@ -1974,8 +1966,7 @@ impl PhysicalPlanner {
Self::create_aggr_func_expr("stddev_pop", schema, vec![child], func)
}
stats_type => Err(GeneralError(format!(
- "Unknown StatisticsType {:?} for stddev",
- stats_type
+ "Unknown StatisticsType {stats_type:?} for stddev"
))),
}
}
diff --git a/native/core/src/execution/shuffle/codec.rs b/native/core/src/execution/shuffle/codec.rs
index e32ab8c51..33e6989d4 100644
--- a/native/core/src/execution/shuffle/codec.rs
+++ b/native/core/src/execution/shuffle/codec.rs
@@ -102,7 +102,7 @@ impl ShuffleBlockWriter {
arrow_writer.write(batch)?;
arrow_writer.finish()?;
wtr.finish().map_err(|e| {
- DataFusionError::Execution(format!("lz4 compression error: {}", e))
+ DataFusionError::Execution(format!("lz4 compression error: {e}"))
})?
}
@@ -121,7 +121,7 @@ impl ShuffleBlockWriter {
arrow_writer.write(batch)?;
arrow_writer.finish()?;
wtr.into_inner().map_err(|e| {
- DataFusionError::Execution(format!("snappy compression error: {}", e))
+ DataFusionError::Execution(format!("snappy compression error: {e}"))
})?
}
};
diff --git a/native/core/src/execution/shuffle/list.rs b/native/core/src/execution/shuffle/list.rs
index 0cd3f396c..c2505a80f 100644
--- a/native/core/src/execution/shuffle/list.rs
+++ b/native/core/src/execution/shuffle/list.rs
@@ -50,11 +50,11 @@ impl SparkUnsafeArray {
let num_elements = i64::from_le_bytes(slice.try_into().unwrap());
if num_elements < 0 {
- panic!("Negative number of elements: {}", num_elements);
+ panic!("Negative number of elements: {num_elements}");
}
if num_elements > i32::MAX as i64 {
- panic!("Number of elements should <= i32::MAX: {}", num_elements);
+ panic!("Number of elements should <= i32::MAX: {num_elements}");
}
Self {
@@ -333,8 +333,7 @@ pub fn append_list_element<T: ArrayBuilder>(
}
_ => {
return Err(CometError::Internal(format!(
- "Unsupported data type in list element: {:?}",
- element_dt
+ "Unsupported data type in list element: {element_dt:?}"
)))
}
}
diff --git a/native/core/src/execution/shuffle/map.rs b/native/core/src/execution/shuffle/map.rs
index c07bd95e2..37df344d6 100644
--- a/native/core/src/execution/shuffle/map.rs
+++ b/native/core/src/execution/shuffle/map.rs
@@ -42,19 +42,16 @@ impl SparkUnsafeMap {
let key_array_size = i64::from_le_bytes(slice.try_into().unwrap());
if key_array_size < 0 {
- panic!("Negative key size in bytes of map: {}", key_array_size);
+ panic!("Negative key size in bytes of map: {key_array_size}");
}
if key_array_size > i32::MAX as i64 {
- panic!(
- "Number of key size in bytes should <= i32::MAX: {}",
- key_array_size
- );
+ panic!("Number of key size in bytes should <= i32::MAX: {key_array_size}");
}
let value_array_size = size - key_array_size as i32 - 8;
if value_array_size < 0 {
- panic!("Negative value size in bytes of map: {}", value_array_size);
+ panic!("Negative value size in bytes of map: {value_array_size}");
}
let keys = SparkUnsafeArray::new(addr + 8);
diff --git a/native/core/src/execution/shuffle/row.rs b/native/core/src/execution/shuffle/row.rs
index c98cc5438..e2f335e1b 100644
--- a/native/core/src/execution/shuffle/row.rs
+++ b/native/core/src/execution/shuffle/row.rs
@@ -3130,7 +3130,7 @@ fn make_builders(
Box::new(StructBuilder::new(fields.clone(), field_builders))
}
- _ => return Err(CometError::Internal(format!("Unsupported type: {:?}", dt))),
+ _ => return Err(CometError::Internal(format!("Unsupported type: {dt:?}"))),
};
Ok(builder)
@@ -3289,7 +3289,7 @@ fn make_batch(arrays: Vec<ArrayRef>, row_count: usize) -> Result<RecordBatch, Ar
let fields = arrays
.iter()
.enumerate()
- .map(|(i, array)| Field::new(format!("c{}", i), array.data_type().clone(), true))
+ .map(|(i, array)| Field::new(format!("c{i}"), array.data_type().clone(), true))
.collect::<Vec<_>>();
let schema = Arc::new(Schema::new(fields));
let options = RecordBatchOptions::new().with_row_count(Option::from(row_count));
diff --git a/native/core/src/execution/shuffle/shuffle_writer.rs b/native/core/src/execution/shuffle/shuffle_writer.rs
index eb3083bff..d23d02a2c 100644
--- a/native/core/src/execution/shuffle/shuffle_writer.rs
+++ b/native/core/src/execution/shuffle/shuffle_writer.rs
@@ -395,7 +395,7 @@ impl MultiPartitionShuffleRepartitioner {
.map(|_| PartitionWriter::try_new(shuffle_block_writer.clone()))
.collect::<Result<Vec<_>>>()?;
- let reservation = MemoryConsumer::new(format!("ShuffleRepartitioner[{}]", partition))
+ let reservation = MemoryConsumer::new(format!("ShuffleRepartitioner[{partition}]"))
.with_can_spill(true)
.register(&runtime.memory_pool);
@@ -619,8 +619,7 @@ impl MultiPartitionShuffleRepartitioner {
// this should be unreachable as long as the validation logic
// in the constructor is kept up-to-date
return Err(DataFusionError::NotImplemented(format!(
- "Unsupported shuffle partitioning scheme {:?}",
- other
+ "Unsupported shuffle partitioning scheme {other:?}"
)));
}
}
@@ -796,7 +795,7 @@ impl ShufflePartitioner for MultiPartitionShuffleRepartitioner {
.create(true)
.truncate(true)
.open(data_file)
- .map_err(|e| DataFusionError::Execution(format!("shuffle write error: {:?}", e)))?;
+ .map_err(|e| DataFusionError::Execution(format!("shuffle write error: {e:?}")))?;
let mut output_data = BufWriter::new(output_data);
@@ -833,9 +832,10 @@ impl ShufflePartitioner for MultiPartitionShuffleRepartitioner {
offsets[num_output_partitions] = output_data.stream_position().map_err(to_df_err)?;
let mut write_timer = self.metrics.write_time.timer();
- let mut output_index = BufWriter::new(File::create(index_file).map_err(|e| {
- DataFusionError::Execution(format!("shuffle write error: {:?}", e))
- })?);
+ let mut output_index =
+ BufWriter::new(File::create(index_file).map_err(|e| {
+ DataFusionError::Execution(format!("shuffle write error: {e:?}"))
+ })?);
for offset in offsets {
output_index
.write_all(&(offset as i64).to_le_bytes()[..])
@@ -1014,7 +1014,7 @@ impl ShufflePartitioner for SinglePartitionShufflePartitioner {
.create(true)
.truncate(true)
.open(self.output_index_path.clone())
- .map_err(|e| DataFusionError::Execution(format!("shuffle write error: {:?}", e)))?;
+ .map_err(|e| DataFusionError::Execution(format!("shuffle write error: {e:?}")))?;
let data_file_length = self
.output_data_writer
.writer
@@ -1036,7 +1036,7 @@ impl ShufflePartitioner for SinglePartitionShufflePartitioner {
}
fn to_df_err(e: Error) -> DataFusionError {
- DataFusionError::Execution(format!("shuffle write error: {:?}", e))
+ DataFusionError::Execution(format!("shuffle write error: {e:?}"))
}
/// A helper struct to produce shuffled batches.
@@ -1197,7 +1197,7 @@ impl PartitionWriter {
.truncate(true)
.open(spill_file.path())
.map_err(|e| {
- DataFusionError::Execution(format!("Error occurred while spilling {}", e))
+ DataFusionError::Execution(format!("Error occurred while spilling {e}"))
})?;
self.spill_file = Some(SpillFile {
temp_file: spill_file,
diff --git a/native/core/src/execution/tracing.rs b/native/core/src/execution/tracing.rs
index 0555e6b14..01351565f 100644
--- a/native/core/src/execution/tracing.rs
+++ b/native/core/src/execution/tracing.rs
@@ -86,7 +86,7 @@ impl Recorder {
fn get_thread_id() -> u64 {
let thread_id = std::thread::current().id();
- format!("{:?}", thread_id)
+ format!("{thread_id:?}")
.trim_start_matches("ThreadId(")
.trim_end_matches(")")
.parse()
diff --git a/native/core/src/execution/util/spark_bloom_filter.rs b/native/core/src/execution/util/spark_bloom_filter.rs
index 79e541c59..ad77cdb49 100644
--- a/native/core/src/execution/util/spark_bloom_filter.rs
+++ b/native/core/src/execution/util/spark_bloom_filter.rs
@@ -61,8 +61,7 @@ impl From<&[u8]> for SparkBloomFilter {
offset += 4;
assert_eq!(
version, SPARK_BLOOM_FILTER_VERSION_1,
- "Unsupported BloomFilter version: {}, expecting version: {}",
- version, SPARK_BLOOM_FILTER_VERSION_1
+ "Unsupported BloomFilter version: {version}, expecting version: {SPARK_BLOOM_FILTER_VERSION_1}"
);
let num_hash_functions = read_num_be_bytes!(i32, 4, buf[offset..]);
offset += 4;
diff --git a/native/core/src/jvm_bridge/mod.rs b/native/core/src/jvm_bridge/mod.rs
index 00e58b709..53ba24ed6 100644
--- a/native/core/src/jvm_bridge/mod.rs
+++ b/native/core/src/jvm_bridge/mod.rs
@@ -272,8 +272,7 @@ impl JVMClasses<'_> {
let java_vm = JAVA_VM.get_unchecked();
java_vm.attach_current_thread().map_err(|e| {
CometError::Internal(format!(
- "JVMClasses::get_env() failed to attach current thread: {}",
- e
+ "JVMClasses::get_env() failed to attach current thread: {e}"
))
})
}
@@ -361,8 +360,7 @@ fn get_throwable_message(
let cause_class_name = get_throwable_class_name(env, jvm_classes, &cause)?;
let cause_message = get_throwable_message(env, jvm_classes, &cause)?;
Ok(format!(
- "{}\nCaused by: {}: {}",
- message_str, cause_class_name, cause_message
+ "{message_str}\nCaused by: {cause_class_name}: {cause_message}"
))
} else {
Ok(message_str)
diff --git a/native/core/src/lib.rs b/native/core/src/lib.rs
index d83ef836a..e8df17074 100644
--- a/native/core/src/lib.rs
+++ b/native/core/src/lib.rs
@@ -93,7 +93,7 @@ pub extern "system" fn Java_org_apache_comet_NativeBase_init(
JAVA_VM.get_or_init(|| java_vm);
let comet_version = env!("CARGO_PKG_VERSION");
- info!("Comet native library version {} initialized", comet_version);
+ info!("Comet native library version {comet_version} initialized");
Ok(())
})
}
diff --git a/native/core/src/parquet/mutable_vector.rs b/native/core/src/parquet/mutable_vector.rs
index a84966c13..6187a5bac 100644
--- a/native/core/src/parquet/mutable_vector.rs
+++ b/native/core/src/parquet/mutable_vector.rs
@@ -225,7 +225,7 @@ impl ParquetMutableVector {
ArrowDataType::FixedSizeBinary(type_length) => *type_length as usize * 8,
ArrowDataType::Decimal128(..) => 128, // Arrow stores decimal with 16 bytes
ArrowDataType::Binary | ArrowDataType::Utf8 => 32, // Only count offset size
- dt => panic!("Unsupported Arrow data type: {:?}", dt),
+ dt => panic!("Unsupported Arrow data type: {dt:?}"),
}
}
diff --git a/native/core/src/parquet/objectstore/s3.rs b/native/core/src/parquet/objectstore/s3.rs
index c1301272f..e93f99a87 100644
--- a/native/core/src/parquet/objectstore/s3.rs
+++ b/native/core/src/parquet/objectstore/s3.rs
@@ -63,7 +63,7 @@ pub fn create_store(
if scheme != ObjectStoreScheme::AmazonS3 {
return Err(object_store::Error::Generic {
store: "S3",
- source: format!("Scheme of URL is not S3: {}", url).into(),
+ source: format!("Scheme of URL is not S3: {url}").into(),
});
}
let path = Path::from_url_path(path)?;
@@ -84,7 +84,7 @@ pub fn create_store(
};
let s3_configs = extract_s3_config_options(configs, bucket);
- debug!("S3 configs for bucket {}: {:?}", bucket, s3_configs);
+ debug!("S3 configs for bucket {bucket}: {s3_configs:?}");
// When using the default AWS S3 endpoint (no custom endpoint configured), a valid region
// is required. If no region is explicitly configured, attempt to auto-resolve it by
@@ -94,7 +94,7 @@ pub fn create_store(
{
let region =
get_runtime().block_on(resolve_bucket_region(bucket, &ClientOptions::new()))?;
- debug!("resolved region: {:?}", region);
+ debug!("resolved region: {region:?}");
builder = builder.with_config(AmazonS3ConfigKey::Region, region.to_string());
}
@@ -178,16 +178,16 @@ fn normalize_endpoint(
}
let endpoint = if !endpoint.starts_with("http://") && !endpoint.starts_with("https://") {
- format!("https://{}", endpoint)
+ format!("https://{endpoint}")
} else {
endpoint.to_string()
};
if virtual_hosted_style_request {
if endpoint.ends_with("/") {
- Some(format!("{}{}", endpoint, bucket))
+ Some(format!("{endpoint}{bucket}"))
} else {
- Some(format!("{}/{}", endpoint, bucket))
+ Some(format!("{endpoint}/{bucket}"))
}
} else {
Some(endpoint) // Avoid extra to_string() call since endpoint is already a String
@@ -199,9 +199,9 @@ fn get_config<'a>(
bucket: &str,
property: &str,
) -> Option<&'a String> {
- let per_bucket_key = format!("fs.s3a.bucket.{}.{}", bucket, property);
+ let per_bucket_key = format!("fs.s3a.bucket.{bucket}.{property}");
configs.get(&per_bucket_key).or_else(|| {
- let global_key = format!("fs.s3a.{}", property);
+ let global_key = format!("fs.s3a.{property}");
configs.get(&global_key)
})
}
@@ -361,11 +361,7 @@ fn build_aws_credential_provider_metadata(
AWS_WEB_IDENTITY_V1 | AWS_WEB_IDENTITY => Ok(CredentialProviderMetadata::WebIdentity),
_ => Err(object_store::Error::Generic {
store: "S3",
- source: format!(
- "Unsupported credential provider: {}",
- credential_provider_name
- )
- .into(),
+ source: format!("Unsupported credential provider: {credential_provider_name}").into(),
}),
}
}
@@ -508,7 +504,7 @@ impl CachedAwsCredentialProvider {
async fn refresh_credential(&self) -> object_store::Result<aws_credential_types::Credentials> {
let credentials = self.provider.provide_credentials().await.map_err(|e| {
- error!("Failed to retrieve credentials: {:?}", e);
+ error!("Failed to retrieve credentials: {e:?}");
object_store::Error::Generic {
store: "S3",
source: Box::new(e),
@@ -631,7 +627,7 @@ impl CredentialProviderMetadata {
CredentialProviderMetadata::Environment => "Environment".to_string(),
CredentialProviderMetadata::WebIdentity => "WebIdentity".to_string(),
CredentialProviderMetadata::Static { is_valid, .. } => {
- format!("Static(valid: {})", is_valid)
+ format!("Static(valid: {is_valid})")
}
CredentialProviderMetadata::AssumeRole {
role_arn,
@@ -776,7 +772,7 @@ mod tests {
fn with_bucket_credential_provider(mut self, bucket: &str, provider: &str) -> Self {
self.configs.insert(
- format!("fs.s3a.bucket.{}.aws.credentials.provider", bucket),
+ format!("fs.s3a.bucket.{bucket}.aws.credentials.provider"),
provider.to_string(),
);
self
@@ -802,7 +798,7 @@ mod tests {
fn with_bucket_access_key(mut self, bucket: &str, key: &str) -> Self {
self.configs.insert(
- format!("fs.s3a.bucket.{}.access.key", bucket),
+ format!("fs.s3a.bucket.{bucket}.access.key"),
key.to_string(),
);
self
@@ -810,7 +806,7 @@ mod tests {
fn with_bucket_secret_key(mut self, bucket: &str, key: &str) -> Self {
self.configs.insert(
- format!("fs.s3a.bucket.{}.secret.key", bucket),
+ format!("fs.s3a.bucket.{bucket}.secret.key"),
key.to_string(),
);
self
@@ -818,7 +814,7 @@ mod tests {
fn with_bucket_session_token(mut self, bucket: &str, token: &str) -> Self {
self.configs.insert(
- format!("fs.s3a.bucket.{}.session.token", bucket),
+ format!("fs.s3a.bucket.{bucket}.session.token"),
token.to_string(),
);
self
@@ -903,10 +899,8 @@ mod tests {
let credential_provider_names = parse_credential_provider_names(HADOOP_ANONYMOUS);
assert_eq!(credential_provider_names, vec![HADOOP_ANONYMOUS]);
- let aws_credential_provider_names = format!(
- "{},{},{}",
- HADOOP_ANONYMOUS, AWS_ENVIRONMENT, AWS_ENVIRONMENT_V1
- );
+ let aws_credential_provider_names =
+ format!("{HADOOP_ANONYMOUS},{AWS_ENVIRONMENT},{AWS_ENVIRONMENT_V1}");
let credential_provider_names =
parse_credential_provider_names(&aws_credential_provider_names);
assert_eq!(
@@ -914,10 +908,8 @@ mod tests {
vec![HADOOP_ANONYMOUS, AWS_ENVIRONMENT, AWS_ENVIRONMENT_V1]
);
- let aws_credential_provider_names = format!(
- " {}, {},, {},",
- HADOOP_ANONYMOUS, AWS_ENVIRONMENT, AWS_ENVIRONMENT_V1
- );
+ let aws_credential_provider_names =
+ format!(" {HADOOP_ANONYMOUS}, {AWS_ENVIRONMENT},, {AWS_ENVIRONMENT_V1},");
let credential_provider_names =
parse_credential_provider_names(&aws_credential_provider_names);
assert_eq!(
@@ -926,8 +918,7 @@ mod tests {
);
let aws_credential_provider_names = format!(
- "\n {},\n {},\n , \n {},\n",
- HADOOP_ANONYMOUS, AWS_ENVIRONMENT, AWS_ENVIRONMENT_V1
+ "\n {HADOOP_ANONYMOUS},\n {AWS_ENVIRONMENT},\n , \n {AWS_ENVIRONMENT_V1},\n"
);
let credential_provider_names =
parse_credential_provider_names(&aws_credential_provider_names);
@@ -984,7 +975,7 @@ mod tests {
#[cfg_attr(miri, ignore)] // AWS credential providers call foreign functions
async fn test_mixed_anonymous_and_other_providers_error() {
let configs = TestConfigBuilder::new()
- .with_credential_provider(&format!("{},{}", HADOOP_ANONYMOUS, AWS_ENVIRONMENT))
+ .with_credential_provider(&format!("{HADOOP_ANONYMOUS},{AWS_ENVIRONMENT}"))
.build();
let result =
@@ -1404,8 +1395,7 @@ mod tests {
// Test three providers in chain: Environment -> IMDS -> ECS
let configs = TestConfigBuilder::new()
.with_credential_provider(&format!(
- "{},{},{}",
- AWS_ENVIRONMENT, AWS_INSTANCE_PROFILE, AWS_CONTAINER_CREDENTIALS
+ "{AWS_ENVIRONMENT},{AWS_INSTANCE_PROFILE},{AWS_CONTAINER_CREDENTIALS}"
))
.build();
@@ -1433,8 +1423,7 @@ mod tests {
// Test chaining static credentials -> environment -> web identity
let configs = TestConfigBuilder::new()
.with_credential_provider(&format!(
- "{},{},{}",
- HADOOP_SIMPLE, AWS_ENVIRONMENT, AWS_WEB_IDENTITY
+ "{HADOOP_SIMPLE},{AWS_ENVIRONMENT},{AWS_WEB_IDENTITY}"
))
.with_access_key("chain_access_key")
.with_secret_key("chain_secret_key")
@@ -1536,8 +1525,7 @@ mod tests {
.with_assume_role_arn("arn:aws:iam::123456789012:role/chained-role")
.with_assume_role_session_name("chained-base-session")
.with_assume_role_credentials_provider(&format!(
- "{},{},{}",
- HADOOP_SIMPLE, AWS_ENVIRONMENT, AWS_INSTANCE_PROFILE
+ "{HADOOP_SIMPLE},{AWS_ENVIRONMENT},{AWS_INSTANCE_PROFILE}"
))
.with_access_key("chained_base_access_key")
.with_secret_key("chained_base_secret_key")
@@ -1576,14 +1564,12 @@ mod tests {
// Test assume role as first provider in a chain, followed by environment and IMDS
let configs = TestConfigBuilder::new()
.with_credential_provider(&format!(
- " {}\n, {}\n",
- HADOOP_ASSUMED_ROLE, AWS_INSTANCE_PROFILE
+ " {HADOOP_ASSUMED_ROLE}\n, {AWS_INSTANCE_PROFILE}\n"
))
.with_assume_role_arn("arn:aws:iam::123456789012:role/first-in-chain")
.with_assume_role_session_name("first-chain-session")
.with_assume_role_credentials_provider(&format!(
- " {}\n, {}\n, {}\n",
- AWS_WEB_IDENTITY, HADOOP_TEMPORARY, AWS_ENVIRONMENT
+ " {AWS_WEB_IDENTITY}\n, {HADOOP_TEMPORARY}\n, {AWS_ENVIRONMENT}\n"
))
.with_access_key("assume_role_base_key")
.with_secret_key("assume_role_base_secret")
@@ -1706,7 +1692,7 @@ mod tests {
async fn test_invalid_static_credential_provider_should_not_prevent_other_providers_from_working(
) {
let configs = TestConfigBuilder::new()
- .with_credential_provider(&format!("{},{}", HADOOP_TEMPORARY, HADOOP_SIMPLE))
+ .with_credential_provider(&format!("{HADOOP_TEMPORARY},{HADOOP_SIMPLE}"))
.with_access_key("test_access_key")
.with_secret_key("test_secret_key")
.build();
@@ -1757,8 +1743,8 @@ mod tests {
{
let cnt = self.counter.fetch_add(1, Ordering::SeqCst);
let cred = Credentials::builder()
- .access_key_id(format!("test_access_key_{}", cnt))
- .secret_access_key(format!("test_secret_key_{}", cnt))
+ .access_key_id(format!("test_access_key_{cnt}"))
+ .secret_access_key(format!("test_secret_key_{cnt}"))
.expiry(SystemTime::now() + Duration::from_secs(60))
.provider_name("mock_provider")
.build();
@@ -1781,8 +1767,8 @@ mod tests {
);
for k in 0..3 {
let credential = cached_provider.get_credential().await.unwrap();
- assert_eq!(credential.key_id, format!("test_access_key_{}", k));
- assert_eq!(credential.secret_key, format!("test_secret_key_{}", k));
+ assert_eq!(credential.key_id, format!("test_access_key_{k}"));
+ assert_eq!(credential.secret_key, format!("test_secret_key_{k}"));
}
}
diff --git a/native/core/src/parquet/read/column.rs b/native/core/src/parquet/read/column.rs
index 43b9d5ada..9988a89f1 100644
--- a/native/core/src/parquet/read/column.rs
+++ b/native/core/src/parquet/read/column.rs
@@ -293,7 +293,7 @@ impl ColumnReader {
UInt64DecimalColumnReader,
ArrowDataType::Decimal128(20u8, 0i8)
),
- _ => panic!("Unsupported INT64 annotation: {:?}", lt),
+ _ => panic!("Unsupported INT64 annotation: {lt:?}"),
},
LogicalType::Decimal {
scale: _,
@@ -351,7 +351,7 @@ impl ColumnReader {
}
}
}
- lt => panic!("Unsupported logical type for INT64: {:?}", lt),
+ lt => panic!("Unsupported logical type for INT64: {lt:?}"),
}
} else {
match promotion_info.physical_type {
@@ -385,7 +385,7 @@ impl ColumnReader {
// We support type promotion from float to double
PhysicalType::FLOAT => typed_reader!(FloatColumnReader, Float32),
PhysicalType::DOUBLE => typed_reader!(FloatToDoubleColumnReader, Float64),
- t => panic!("Unsupported read physical type: {} for FLOAT", t),
+ t => panic!("Unsupported read physical type: {t} for FLOAT"),
},
PhysicalType::DOUBLE => typed_reader!(DoubleColumnReader, Float64),
@@ -396,7 +396,7 @@ impl ColumnReader {
// https://github.com/apache/parquet-format/blob/master/LogicalTypes.md
// "enum type should interpret ENUM annotated field as a UTF-8"
LogicalType::Enum => typed_reader!(StringColumnReader, Utf8),
- lt => panic!("Unsupported logical type for BYTE_ARRAY: {:?}", lt),
+ lt => panic!("Unsupported logical type for BYTE_ARRAY: {lt:?}"),
}
} else {
typed_reader!(ByteArrayColumnReader, Binary)
@@ -438,7 +438,7 @@ impl ColumnReader {
ArrowDataType::FixedSizeBinary(type_length)
)
}
- t => panic!("Unsupported logical type for FIXED_LEN_BYTE_ARRAY: {:?}", t),
+ t => panic!("Unsupported logical type for FIXED_LEN_BYTE_ARRAY: {t:?}"),
}
} else {
let type_length = desc.type_length();
@@ -775,7 +775,7 @@ impl<T: DataType> TypedColumnReader<T> {
}
if encoding != Encoding::PLAIN_DICTIONARY {
- panic!("Invalid encoding type for Parquet dictionary: {}", encoding);
+ panic!("Invalid encoding type for Parquet dictionary: {encoding}");
}
if self.vector.dictionary.is_some() {
@@ -973,8 +973,7 @@ impl<T: DataType> TypedColumnReader<T> {
fn check_const(&mut self, method_name: &str) {
assert!(
self.value_decoder.is_none(),
- "{} cannot be called after set_page_v1/set_page_v2!",
- method_name
+ "{method_name} cannot be called after set_page_v1/set_page_v2!"
);
assert!(!self.is_const, "can only set constant once!");
self.is_const = true;
diff --git a/native/core/src/parquet/read/values.rs b/native/core/src/parquet/read/values.rs
index e28d695ec..84fe2991e 100644
--- a/native/core/src/parquet/read/values.rs
+++ b/native/core/src/parquet/read/values.rs
@@ -44,7 +44,7 @@ pub fn get_decoder<T: DataType>(
}
// This is for dictionary indices
Encoding::RLE_DICTIONARY => Box::new(DictDecoder::new(value_data)),
- _ => panic!("Unsupported encoding: {}", encoding),
+ _ => panic!("Unsupported encoding: {encoding}"),
};
decoder
}
@@ -325,11 +325,10 @@ impl PlainDecoding for Int64TimestampMillisType {
// efficient
if unlikely(v < JULIAN_GREGORIAN_SWITCH_OFF_TS) {
panic!(
- "Encountered timestamp value {}, which is before 1582-10-15 (counting \
+ "Encountered timestamp value {v}, which is before 1582-10-15 (counting \
backwards from Unix epoch date 1970-01-01), and could be ambigous \
depending on whether a legacy Julian/Gregorian hybrid calendar is used, \
- or a Proleptic Gregorian calendar is used.",
- v
+ or a Proleptic Gregorian calendar is used."
);
}
@@ -842,11 +841,10 @@ impl PlainDecoding for Int96TimestampMicrosType {
if unlikely(micros < JULIAN_GREGORIAN_SWITCH_OFF_TS) {
panic!(
- "Encountered timestamp value {}, which is before 1582-10-15 (counting \
+ "Encountered timestamp value {micros}, which is before 1582-10-15 (counting \
backwards from Unix epoch date 1970-01-01), and could be ambigous \
depending on whether a legacy Julian/Gregorian hybrid calendar is used, \
- or a Proleptic Gregorian calendar is used.",
- micros
+ or a Proleptic Gregorian calendar is used."
);
}
diff --git a/native/core/src/parquet/util/jni.rs b/native/core/src/parquet/util/jni.rs
index 6be7a7269..d7d86a5e2 100644
--- a/native/core/src/parquet/util/jni.rs
+++ b/native/core/src/parquet/util/jni.rs
@@ -94,7 +94,7 @@ pub fn convert_encoding(ordinal: jint) -> Encoding {
6 => Encoding::DELTA_LENGTH_BYTE_ARRAY,
7 => Encoding::DELTA_BYTE_ARRAY,
8 => Encoding::RLE_DICTIONARY,
- _ => panic!("Invalid Java Encoding ordinal: {}", ordinal),
+ _ => panic!("Invalid Java Encoding ordinal: {ordinal}"),
}
}
@@ -153,7 +153,7 @@ fn convert_physical_type(id: jint) -> PhysicalType {
5 => PhysicalType::DOUBLE,
6 => PhysicalType::BYTE_ARRAY,
7 => PhysicalType::FIXED_LEN_BYTE_ARRAY,
- _ => panic!("Invalid id for Parquet physical type: {} ", id),
+ _ => panic!("Invalid id for Parquet physical type: {id} "),
}
}
@@ -180,7 +180,7 @@ fn convert_logical_type(
},
5 => LogicalType::Enum,
6 => LogicalType::Uuid,
- _ => panic!("Invalid id for Parquet logical type: {}", id),
+ _ => panic!("Invalid id for Parquet logical type: {id}"),
}
}
@@ -189,7 +189,7 @@ fn convert_time_unit(time_unit: jint) -> TimeUnit {
0 => TimeUnit::MILLIS(MilliSeconds::new()),
1 => TimeUnit::MICROS(MicroSeconds::new()),
2 => TimeUnit::NANOS(NanoSeconds::new()),
- _ => panic!("Invalid time unit id for Parquet: {}", time_unit),
+ _ => panic!("Invalid time unit id for Parquet: {time_unit}"),
}
}
diff --git a/native/core/src/parquet/util/test_common/page_util.rs b/native/core/src/parquet/util/test_common/page_util.rs
index c87505a48..e4e3e30c4 100644
--- a/native/core/src/parquet/util/test_common/page_util.rs
+++ b/native/core/src/parquet/util/test_common/page_util.rs
@@ -288,7 +288,7 @@ pub fn make_pages<T: DataType>(
Encoding::PLAIN => {
pb.add_values::<T>(encoding, &values[value_range]);
}
- enc => panic!("Unexpected encoding {}", enc),
+ enc => panic!("Unexpected encoding {enc}"),
}
let data_page = pb.consume();
diff --git a/native/hdfs/src/object_store/hdfs.rs b/native/hdfs/src/object_store/hdfs.rs
index a880af871..012378271 100644
--- a/native/hdfs/src/object_store/hdfs.rs
+++ b/native/hdfs/src/object_store/hdfs.rs
@@ -470,7 +470,7 @@ fn check_modified(
if last_modified <= date {
return Err(Error::NotModified {
path: location.to_string(),
- source: format!("{} >= {}", date, last_modified).into(),
+ source: format!("{date} >= {last_modified}").into(),
});
}
}
@@ -479,7 +479,7 @@ fn check_modified(
if last_modified > date {
return Err(Error::Precondition {
path: location.to_string(),
- source: format!("{} < {}", date, last_modified).into(),
+ source: format!("{date} < {last_modified}").into(),
});
}
}
diff --git a/native/spark-expr/src/array_funcs/array_insert.rs b/native/spark-expr/src/array_funcs/array_insert.rs
index 93946e8d2..eb96fec12 100644
--- a/native/spark-expr/src/array_funcs/array_insert.rs
+++ b/native/spark-expr/src/array_funcs/array_insert.rs
@@ -86,8 +86,7 @@ impl ArrayInsert {
DataType::List(field) => Ok(DataType::List(Arc::clone(field))),
DataType::LargeList(field) => Ok(DataType::LargeList(Arc::clone(field))),
data_type => Err(DataFusionError::Internal(format!(
- "Unexpected src array type in ArrayInsert: {:?}",
- data_type
+ "Unexpected src array type in ArrayInsert: {data_type:?}"
))),
}
}
@@ -248,8 +247,7 @@ fn array_insert<O: OffsetSizeTrait>(
let new_array_len = std::cmp::max(end - start + 1, corrected_pos);
if new_array_len > MAX_ROUNDED_ARRAY_LENGTH {
return Err(DataFusionError::Internal(format!(
- "Max array length in Spark is {:?}, but got {:?}",
- MAX_ROUNDED_ARRAY_LENGTH, new_array_len
+ "Max array length in Spark is {MAX_ROUNDED_ARRAY_LENGTH:?}, but got {new_array_len:?}"
)));
}
@@ -275,8 +273,7 @@ fn array_insert<O: OffsetSizeTrait>(
let new_array_len = (-pos + base_offset).as_usize();
if new_array_len > MAX_ROUNDED_ARRAY_LENGTH {
return Err(DataFusionError::Internal(format!(
- "Max array length in Spark is {:?}, but got {:?}",
- MAX_ROUNDED_ARRAY_LENGTH, new_array_len
+ "Max array length in Spark is {MAX_ROUNDED_ARRAY_LENGTH:?}, but got {new_array_len:?}"
)));
}
mutable_values.extend(1, row_index, row_index + 1);
diff --git a/native/spark-expr/src/array_funcs/get_array_struct_fields.rs b/native/spark-expr/src/array_funcs/get_array_struct_fields.rs
index 6571a8081..e63fe1f51 100644
--- a/native/spark-expr/src/array_funcs/get_array_struct_fields.rs
+++ b/native/spark-expr/src/array_funcs/get_array_struct_fields.rs
@@ -59,8 +59,7 @@ impl GetArrayStructFields {
match self.child.data_type(input_schema)? {
DataType::List(field) | DataType::LargeList(field) => Ok(field),
data_type => Err(DataFusionError::Internal(format!(
- "Unexpected data type in GetArrayStructFields: {:?}",
- data_type
+ "Unexpected data type in GetArrayStructFields: {data_type:?}"
))),
}
}
@@ -69,8 +68,7 @@ impl GetArrayStructFields {
match self.list_field(input_schema)?.data_type() {
DataType::Struct(fields) => Ok(Arc::clone(&fields[self.ordinal])),
data_type => Err(DataFusionError::Internal(format!(
- "Unexpected data type in GetArrayStructFields: {:?}",
- data_type
+ "Unexpected data type in GetArrayStructFields: {data_type:?}"
))),
}
}
@@ -87,8 +85,7 @@ impl PhysicalExpr for GetArrayStructFields {
DataType::List(_) => Ok(DataType::List(struct_field)),
DataType::LargeList(_) => Ok(DataType::LargeList(struct_field)),
data_type => Err(DataFusionError::Internal(format!(
- "Unexpected data type in GetArrayStructFields: {:?}",
- data_type
+ "Unexpected data type in GetArrayStructFields: {data_type:?}"
))),
}
}
@@ -113,8 +110,7 @@ impl PhysicalExpr for GetArrayStructFields {
get_array_struct_fields(list_array, self.ordinal)
}
data_type => Err(DataFusionError::Internal(format!(
- "Unexpected child type for ListExtract: {:?}",
- data_type
+ "Unexpected child type for ListExtract: {data_type:?}"
))),
}
}
diff --git a/native/spark-expr/src/array_funcs/list_extract.rs b/native/spark-expr/src/array_funcs/list_extract.rs
index 7336fb65f..f015d4e9d 100644
--- a/native/spark-expr/src/array_funcs/list_extract.rs
+++ b/native/spark-expr/src/array_funcs/list_extract.rs
@@ -80,8 +80,7 @@ impl ListExtract {
match self.child.data_type(input_schema)? {
DataType::List(field) | DataType::LargeList(field) => Ok(field),
data_type => Err(DataFusionError::Internal(format!(
- "Unexpected data type in ListExtract: {:?}",
- data_type
+ "Unexpected data type in ListExtract: {data_type:?}"
))),
}
}
@@ -121,8 +120,7 @@ impl PhysicalExpr for ListExtract {
}
ColumnarValue::Scalar(scalar) => Ok(scalar),
v => Err(DataFusionError::Execution(format!(
- "Expected scalar default value for ListExtract, got {:?}",
- v
+ "Expected scalar default value for ListExtract, got {v:?}"
))),
})
})
@@ -161,8 +159,7 @@ impl PhysicalExpr for ListExtract {
)
}
data_type => Err(DataFusionError::Internal(format!(
- "Unexpected child type for ListExtract: {:?}",
- data_type
+ "Unexpected child type for ListExtract: {data_type:?}"
))),
}
}
diff --git a/native/spark-expr/src/datetime_funcs/date_arithmetic.rs b/native/spark-expr/src/datetime_funcs/date_arithmetic.rs
index f3b764593..4b4db2eb5 100644
--- a/native/spark-expr/src/datetime_funcs/date_arithmetic.rs
+++ b/native/spark-expr/src/datetime_funcs/date_arithmetic.rs
@@ -79,8 +79,7 @@ fn spark_date_arithmetic(
}
_ => {
return Err(DataFusionError::Internal(format!(
- "Unsupported data types {:?} for date arithmetic.",
- args,
+ "Unsupported data types {args:?} for date arithmetic.",
)))
}
}
@@ -88,8 +87,7 @@ fn spark_date_arithmetic(
datum::apply(start, &interval_cv, op)
}
_ => Err(DataFusionError::Internal(format!(
- "Unsupported data types {:?} for date arithmetic.",
- args,
+ "Unsupported data types {args:?} for date arithmetic.",
))),
}
}
diff --git a/native/spark-expr/src/kernels/strings.rs b/native/spark-expr/src/kernels/strings.rs
index 00da38239..f9e0b1311 100644
--- a/native/spark-expr/src/kernels/strings.rs
+++ b/native/spark-expr/src/kernels/strings.rs
@@ -44,10 +44,7 @@ pub fn string_space(length: &dyn Array) -> Result<ArrayRef, DataFusionError> {
let result = DictionaryArray::try_new(dict.keys().clone(), values)?;
Ok(Arc::new(result))
}
- dt => panic!(
- "Unsupported input type for function 'string_space': {:?}",
- dt
- ),
+ dt => panic!("Unsupported input type for function 'string_space': {dt:?}"),
}
}
@@ -82,7 +79,7 @@ pub fn substring(array: &dyn Array, start: i64, length: u64) -> Result<ArrayRef,
let result = DictionaryArray::try_new(dict.keys().clone(), values)?;
Ok(Arc::new(result))
}
- dt => panic!("Unsupported input type for function 'substring': {:?}", dt),
+ dt => panic!("Unsupported input type for function 'substring': {dt:?}"),
}
}
diff --git a/native/spark-expr/src/kernels/temporal.rs b/native/spark-expr/src/kernels/temporal.rs
index a6d2a87d1..09e2c905c 100644
--- a/native/spark-expr/src/kernels/temporal.rs
+++ b/native/spark-expr/src/kernels/temporal.rs
@@ -307,8 +307,7 @@ where
|dt| as_days_from_unix_epoch(trunc_date_to_week(dt)),
)),
_ => Err(SparkError::Internal(format!(
- "Unsupported format: {:?} for function 'date_trunc'",
- format
+ "Unsupported format: {format:?} for function 'date_trunc'"
))),
},
dt => return_compute_error_with!(
@@ -399,8 +398,7 @@ pub(crate) fn date_trunc_array_fmt_dyn(
)
.map(|a| Arc::new(a) as ArrayRef),
(dt, fmt) => Err(SparkError::Internal(format!(
- "Unsupported datatype: {:}, format: {:?} for function 'date_trunc'",
- dt, fmt
+ "Unsupported datatype: {dt:}, format: {fmt:?} for function 'date_trunc'"
))),
}
}
@@ -588,8 +586,7 @@ where
})
}
_ => Err(SparkError::Internal(format!(
- "Unsupported format: {:?} for function 'timestamp_trunc'",
- format
+ "Unsupported format: {format:?} for function 'timestamp_trunc'"
))),
}
}
@@ -668,8 +665,7 @@ pub(crate) fn timestamp_trunc_array_fmt_dyn(
)
}
(dt, fmt) => Err(SparkError::Internal(format!(
- "Unsupported datatype: {:}, format: {:?} for function 'timestamp_trunc'",
- dt, fmt
+ "Unsupported datatype: {dt:}, format: {fmt:?} for function 'timestamp_trunc'"
))),
}
}
diff --git a/native/spark-expr/src/math_funcs/ceil.rs b/native/spark-expr/src/math_funcs/ceil.rs
index 2d6b84ab3..e797a1c86 100644
--- a/native/spark-expr/src/math_funcs/ceil.rs
+++ b/native/spark-expr/src/math_funcs/ceil.rs
@@ -51,8 +51,7 @@ pub fn spark_ceil(
make_decimal_array(array, precision, scale, &f)
}
other => Err(DataFusionError::Internal(format!(
- "Unsupported data type {:?} for function ceil",
- other,
+ "Unsupported data type {other:?} for function ceil",
))),
},
ColumnarValue::Scalar(a) => match a {
diff --git a/native/spark-expr/src/math_funcs/floor.rs b/native/spark-expr/src/math_funcs/floor.rs
index 5547d78a2..8e7429428 100644
--- a/native/spark-expr/src/math_funcs/floor.rs
+++ b/native/spark-expr/src/math_funcs/floor.rs
@@ -51,8 +51,7 @@ pub fn spark_floor(
make_decimal_array(array, precision, scale, &f)
}
other => Err(DataFusionError::Internal(format!(
- "Unsupported data type {:?} for function floor",
- other,
+ "Unsupported data type {other:?} for function floor",
))),
},
ColumnarValue::Scalar(a) => match a {
diff --git a/native/spark-expr/src/math_funcs/hex.rs b/native/spark-expr/src/math_funcs/hex.rs
index 52b7d8c08..4837e0946 100644
--- a/native/spark-expr/src/math_funcs/hex.rs
+++ b/native/spark-expr/src/math_funcs/hex.rs
@@ -31,7 +31,7 @@ use datafusion::logical_expr::ColumnarValue;
use std::fmt::Write;
fn hex_int64(num: i64) -> String {
- format!("{:X}", num)
+ format!("{num:X}")
}
#[inline(always)]
diff --git a/native/spark-expr/src/math_funcs/internal/checkoverflow.rs b/native/spark-expr/src/math_funcs/internal/checkoverflow.rs
index a584b4e9c..2276dba3d 100644
--- a/native/spark-expr/src/math_funcs/internal/checkoverflow.rs
+++ b/native/spark-expr/src/math_funcs/internal/checkoverflow.rs
@@ -105,8 +105,7 @@ impl PhysicalExpr for CheckOverflow {
DataType::Decimal128(p, s) => (p, s),
dt => {
return Err(DataFusionError::Execution(format!(
- "CheckOverflow expects only Decimal128, but got {:?}",
- dt
+ "CheckOverflow expects only Decimal128, but got {dt:?}"
)))
}
};
@@ -147,8 +146,7 @@ impl PhysicalExpr for CheckOverflow {
)))
}
v => Err(DataFusionError::Execution(format!(
- "CheckOverflow's child expression should be decimal array, but found {:?}",
- v
+ "CheckOverflow's child expression should be decimal array, but found {v:?}"
))),
}
}
diff --git a/native/spark-expr/src/math_funcs/internal/normalize_nan.rs b/native/spark-expr/src/math_funcs/internal/normalize_nan.rs
index c04371306..7f564aa0d 100644
--- a/native/spark-expr/src/math_funcs/internal/normalize_nan.rs
+++ b/native/spark-expr/src/math_funcs/internal/normalize_nan.rs
@@ -87,7 +87,7 @@ impl PhysicalExpr for NormalizeNaNAndZero {
let new_array = Float64Array::from(v);
Ok(ColumnarValue::Array(Arc::new(new_array)))
}
- dt => panic!("Unexpected data type {:?}", dt),
+ dt => panic!("Unexpected data type {dt:?}"),
}
}
diff --git a/native/spark-expr/src/nondetermenistic_funcs/rand.rs b/native/spark-expr/src/nondetermenistic_funcs/rand.rs
index 903661f4f..d82c2cd92 100644
--- a/native/spark-expr/src/nondetermenistic_funcs/rand.rs
+++ b/native/spark-expr/src/nondetermenistic_funcs/rand.rs
@@ -163,8 +163,7 @@ impl PhysicalExpr for RandExpr {
match self.seed.evaluate(batch)? {
ColumnarValue::Scalar(seed) => self.evaluate_batch(seed, batch.num_rows()),
ColumnarValue::Array(_arr) => Err(DataFusionError::NotImplemented(format!(
- "Only literal seeds are supported for {}",
- self
+ "Only literal seeds are supported for {self}"
))),
}
}
diff --git a/native/spark-expr/src/predicate_funcs/is_nan.rs b/native/spark-expr/src/predicate_funcs/is_nan.rs
index cce5e8f5f..01da1f1e7 100644
--- a/native/spark-expr/src/predicate_funcs/is_nan.rs
+++ b/native/spark-expr/src/predicate_funcs/is_nan.rs
@@ -50,8 +50,7 @@ pub fn spark_isnan(args: &[ColumnarValue]) -> Result<ColumnarValue, DataFusionEr
Ok(set_nulls_to_false(is_nan))
}
other => Err(DataFusionError::Internal(format!(
- "Unsupported data type {:?} for function isnan",
- other,
+ "Unsupported data type {other:?} for function isnan",
))),
},
ColumnarValue::Scalar(a) => match a {
diff --git a/native/spark-expr/src/predicate_funcs/rlike.rs b/native/spark-expr/src/predicate_funcs/rlike.rs
index 179f58394..0fac45d67 100644
--- a/native/spark-expr/src/predicate_funcs/rlike.rs
+++ b/native/spark-expr/src/predicate_funcs/rlike.rs
@@ -69,7 +69,7 @@ impl RLike {
child,
pattern_str: pattern.to_string(),
pattern: Regex::new(pattern).map_err(|e| {
- SparkError::Internal(format!("Failed to compile pattern {}: {}", pattern, e))
+ SparkError::Internal(format!("Failed to compile pattern {pattern}: {e}"))
})?,
})
}
diff --git a/native/spark-expr/src/struct_funcs/get_struct_field.rs b/native/spark-expr/src/struct_funcs/get_struct_field.rs
index 6c0ef5ee3..c47211aef 100644
--- a/native/spark-expr/src/struct_funcs/get_struct_field.rs
+++ b/native/spark-expr/src/struct_funcs/get_struct_field.rs
@@ -55,8 +55,7 @@ impl GetStructField {
match self.child.data_type(input_schema)? {
DataType::Struct(fields) => Ok(Arc::clone(&fields[self.ordinal])),
data_type => Err(DataFusionError::Plan(format!(
- "Expect struct field, got {:?}",
- data_type
+ "Expect struct field, got {data_type:?}"
))),
}
}
@@ -97,8 +96,7 @@ impl PhysicalExpr for GetStructField {
Arc::clone(struct_array.column(self.ordinal)),
)),
value => Err(DataFusionError::Execution(format!(
- "Expected a struct array, got {:?}",
- value
+ "Expected a struct array, got {value:?}"
))),
}
}
diff --git a/native/spark-expr/src/timezone.rs b/native/spark-expr/src/timezone.rs
index 408deabef..702ed236c 100644
--- a/native/spark-expr/src/timezone.rs
+++ b/native/spark-expr/src/timezone.rs
@@ -41,8 +41,7 @@ fn parse_fixed_offset(tz: &str) -> Result<FixedOffset, ArrowError> {
}
Err(ArrowError::ParseError(format!(
- "Invalid timezone \"{}\": Expected format [+-]XX:XX, [+-]XX, or [+-]XXXX",
- tz
+ "Invalid timezone \"{tz}\": Expected format [+-]XX:XX, [+-]XX, or [+-]XXXX"
)))
}
@@ -83,7 +82,7 @@ impl FromStr for Tz {
Ok(Self(TzInner::Offset(parse_fixed_offset(tz)?)))
} else {
Ok(Self(TzInner::Timezone(tz.parse().map_err(|e| {
- ArrowError::ParseError(format!("Invalid timezone \"{}\": {}", tz, e))
+ ArrowError::ParseError(format!("Invalid timezone \"{tz}\": {e}"))
})?)))
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org