Skip to content

Commit 37cc3b9

Browse files
committed
Merge remote-tracking branch 'apache/main' into alamb/default_arc
2 parents 95586f1 + 777ecb8 commit 37cc3b9

18 files changed

Lines changed: 122 additions & 16 deletions

File tree

datafusion/common/src/hash_utils.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ hash_float_value!((half::f16, u16), (f32, u32), (f64, u64));
201201
/// Create a `SeedableRandomState` whose per-hasher seed incorporates `seed`.
202202
/// This folds the previous hash into the hasher's initial state so only the
203203
/// new value needs to pass through the hash function — same cost as `hash_one`.
204+
#[cfg(not(feature = "force_hash_collisions"))]
204205
#[inline]
205206
#[cfg(not(feature = "force_hash_collisions"))]
206207
fn seeded_state(seed: u64) -> foldhash::fast::SeedableRandomState {
@@ -307,6 +308,7 @@ fn hash_array<T>(
307308
/// HAS_NULLS: do we have to check null in the inner loop
308309
/// HAS_BUFFERS: if true, array has external buffers; if false, all strings are inlined/ less then 12 bytes
309310
/// REHASH: if true, combining with existing hash, otherwise initializing
311+
#[cfg(not(feature = "force_hash_collisions"))]
310312
#[inline(never)]
311313
#[cfg(not(feature = "force_hash_collisions"))]
312314
fn hash_string_view_array_inner<
@@ -434,6 +436,7 @@ fn hash_generic_byte_view_array<T: ByteViewType>(
434436
/// - `HAS_NULL_KEYS`: Whether to check for null dictionary keys
435437
/// - `HAS_NULL_VALUES`: Whether to check for null dictionary values
436438
/// - `MULTI_COL`: Whether to combine with existing hash (true) or initialize (false)
439+
#[cfg(not(feature = "force_hash_collisions"))]
437440
#[inline(never)]
438441
#[cfg(not(feature = "force_hash_collisions"))]
439442
fn hash_dictionary_inner<

datafusion/common/src/pruning.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ pub trait PruningStatistics {
121121
/// container, return `None` (the default).
122122
///
123123
/// Note: the returned array must contain [`Self::num_containers`] rows
124+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // ScalarValue has interior mutability but is intentionally used as hash key
124125
fn contained(
125126
&self,
126127
column: &Column,
@@ -526,6 +527,7 @@ impl PruningStatistics for CompositePruningStatistics {
526527

527528
#[cfg(test)]
528529
#[expect(deprecated)]
530+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // ScalarValue has interior mutability but is intentionally used as hash key
529531
mod tests {
530532
use crate::{
531533
ColumnStatistics,

datafusion/common/src/scalar/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4601,6 +4601,7 @@ impl ScalarValue {
46014601
/// Estimates [size](Self::size) of [`HashSet`] in bytes.
46024602
///
46034603
/// Includes the size of the [`HashSet`] container itself.
4604+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // ScalarValue has interior mutability but is intentionally used as hash key
46044605
pub fn size_of_hashset<S>(set: &HashSet<Self, S>) -> usize {
46054606
size_of_val(set)
46064607
+ (size_of::<ScalarValue>() * set.capacity())
@@ -7263,6 +7264,8 @@ mod tests {
72637264
size_of::<Vec<ScalarValue>>() + (9 * size_of::<ScalarValue>()) + sv_size,
72647265
);
72657266

7267+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)]
7268+
// ScalarValue has interior mutability but is intentionally used as hash key
72667269
let mut s = HashSet::with_capacity(0);
72677270
// do NOT clone `sv` here because this may shrink the vector capacity
72687271
s.insert(v.pop().unwrap());

datafusion/core/src/physical_planner.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,6 +2093,7 @@ fn get_physical_expr_pair(
20932093
/// A vector of unqualified filter expressions that can be passed to the TableProvider for execution.
20942094
/// Returns an empty vector if no applicable filters are found.
20952095
///
2096+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // Expr contains Arc with interior mutability but is intentionally used as hash key
20962097
fn extract_dml_filters(
20972098
input: &Arc<LogicalPlan>,
20982099
target: &TableReference,

datafusion/datasource/src/file_groups.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ impl FileGroup {
488488
///
489489
/// Note: May return fewer groups than `max_target_partitions` when the
490490
/// number of unique partition values is less than the target.
491+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // ScalarValue has interior mutability but is intentionally used as hash key
491492
pub fn group_by_partition_values(
492493
self,
493494
max_target_partitions: usize,

datafusion/expr/src/logical_plan/builder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,6 +2132,8 @@ pub fn wrap_projection_for_join_if_necessary(
21322132
.into_iter()
21332133
.map(Expr::Column)
21342134
.collect::<Vec<_>>();
2135+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)]
2136+
// Expr contains Arc with interior mutability but is intentionally used as hash key
21352137
let join_key_items = alias_join_keys
21362138
.iter()
21372139
.flat_map(|expr| expr.try_as_col().is_none().then_some(expr))

datafusion/functions-aggregate/src/median.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ impl<T: ArrowNumericType> Accumulator for MedianAccumulator<T> {
285285
size_of_val(self) + self.all_values.capacity() * size_of::<T::Native>()
286286
}
287287

288+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // ScalarValue has interior mutability but is intentionally used as hash key
288289
fn retract_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
289290
let mut to_remove: HashMap<ScalarValue, usize> = HashMap::new();
290291

datafusion/functions-aggregate/src/percentile_cont.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ where
440440
size_of_val(self) + self.all_values.capacity() * size_of::<T::Native>()
441441
}
442442

443+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // ScalarValue has interior mutability but is intentionally used as hash key
443444
fn retract_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
444445
let mut to_remove: HashMap<ScalarValue, usize> = HashMap::new();
445446
for i in 0..values[0].len() {

datafusion/optimizer/src/analyzer/resolve_grouping_function.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ fn group_expr_to_bitmap_index(group_expr: &[Expr]) -> Result<HashMap<&Expr, usiz
7272
.collect::<HashMap<_, _>>())
7373
}
7474

75+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // Expr contains Arc with interior mutability but is intentionally used as hash key
7576
fn replace_grouping_exprs(
7677
input: Arc<LogicalPlan>,
7778
schema: &DFSchema,
@@ -158,6 +159,7 @@ fn contains_grouping_function(exprs: &[Expr]) -> bool {
158159
}
159160

160161
/// Validate that the arguments to the grouping function are in the group by clause.
162+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // Expr contains Arc with interior mutability but is intentionally used as hash key
161163
fn validate_args(
162164
function: &AggregateFunction,
163165
group_by_expr: &HashMap<&Expr, usize>,
@@ -178,6 +180,7 @@ fn validate_args(
178180
}
179181
}
180182

183+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)] // Expr contains Arc with interior mutability but is intentionally used as hash key
181184
fn grouping_function_on_id(
182185
function: &AggregateFunction,
183186
group_by_expr: &HashMap<&Expr, usize>,

datafusion/optimizer/src/scalar_subquery_to_join.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ impl OptimizerRule for ScalarSubqueryToJoin {
144144
}
145145

146146
let mut all_subqueries = vec![];
147+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)]
148+
// Expr contains Arc with interior mutability but is intentionally used as hash key
147149
let mut expr_to_rewrite_expr_map = HashMap::new();
150+
#[allow(clippy::allow_attributes, clippy::mutable_key_type)]
151+
// Expr contains Arc with interior mutability but is intentionally used as hash key
148152
let mut subquery_to_expr_map = HashMap::new();
149153
for expr in projection.expr.iter() {
150154
let (subqueries, rewrite_exprs) =

0 commit comments

Comments
 (0)