Skip to content

Commit bad4ba2

Browse files
committed
Merge remote-tracking branch 'apache/main' into askalt/improve-hash-join-exec-builder
2 parents fbb0a89 + e80694e commit bad4ba2

File tree

50 files changed

+873
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+873
-152
lines changed

Cargo.lock

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ serde_json = "1"
185185
sha2 = "^0.10.9"
186186
sqlparser = { version = "0.61.0", default-features = false, features = ["std", "visitor"] }
187187
strum = "0.28.0"
188-
strum_macros = "0.27.2"
188+
strum_macros = "0.28.0"
189189
tempfile = "3"
190190
testcontainers-modules = { version = "0.15" }
191191
tokio = { version = "1.48", features = ["macros", "rt", "sync"] }

datafusion/common/src/alias.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ impl AliasGenerator {
3737
Self::default()
3838
}
3939

40+
/// Advance the counter to at least `min_id`, ensuring future aliases
41+
/// won't collide with already-existing ones.
42+
///
43+
/// For example, if the query already contains an alias `alias_42`, then calling
44+
/// `update_min_id(42)` will ensure that future aliases generated by this
45+
/// [`AliasGenerator`] will start from `alias_43`.
46+
pub fn update_min_id(&self, min_id: usize) {
47+
self.next_id.fetch_max(min_id + 1, Ordering::Relaxed);
48+
}
49+
4050
/// Return a unique alias with the provided prefix
4151
pub fn next(&self, prefix: &str) -> String {
4252
let id = self.next_id.fetch_add(1, Ordering::Relaxed);

datafusion/common/src/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ mod tests {
12651265
col_stats.min_value,
12661266
Precision::Inexact(ScalarValue::Int32(Some(-10)))
12671267
);
1268-
assert!(matches!(col_stats.sum_value, Precision::Absent));
1268+
assert_eq!(col_stats.sum_value, Precision::Absent);
12691269
}
12701270

12711271
#[test]

datafusion/common/src/types/native.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ impl NativeType {
499499

500500
#[inline]
501501
pub fn is_date(&self) -> bool {
502-
matches!(self, NativeType::Date)
502+
*self == NativeType::Date
503503
}
504504

505505
#[inline]
@@ -524,7 +524,7 @@ impl NativeType {
524524

525525
#[inline]
526526
pub fn is_null(&self) -> bool {
527-
matches!(self, NativeType::Null)
527+
*self == NativeType::Null
528528
}
529529

530530
#[inline]

datafusion/core/benches/spm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ fn generate_spm_for_round_robin_tie_breaker(
6666
RecordBatch::try_from_iter(vec![("a", a), ("b", b), ("c", c)]).unwrap()
6767
};
6868

69-
let rbs = (0..batch_count).map(|_| rb.clone()).collect::<Vec<_>>();
70-
let partitions = vec![rbs.clone(); partition_count];
71-
7269
let schema = rb.schema();
70+
let rbs = std::iter::repeat_n(rb, batch_count).collect::<Vec<_>>();
71+
let partitions = vec![rbs.clone(); partition_count];
7372
let sort = [
7473
PhysicalSortExpr {
7574
expr: col("b", &schema).unwrap(),

datafusion/core/src/physical_planner.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ impl DefaultPhysicalPlanner {
13951395

13961396
// TODO: Allow PWMJ to deal with residual equijoin conditions
13971397
let join: Arc<dyn ExecutionPlan> = if join_on.is_empty() {
1398-
if join_filter.is_none() && matches!(join_type, JoinType::Inner) {
1398+
if join_filter.is_none() && *join_type == JoinType::Inner {
13991399
// cross join if there is no join conditions and no join filter set
14001400
Arc::new(CrossJoinExec::new(physical_left, physical_right))
14011401
} else if num_range_filters == 1
@@ -1470,9 +1470,7 @@ impl DefaultPhysicalPlanner {
14701470

14711471
let left_side = side_of(lhs_logical)?;
14721472
let right_side = side_of(rhs_logical)?;
1473-
if matches!(left_side, Side::Both)
1474-
|| matches!(right_side, Side::Both)
1475-
{
1473+
if left_side == Side::Both || right_side == Side::Both {
14761474
return Ok(Arc::new(NestedLoopJoinExec::try_new(
14771475
physical_left,
14781476
physical_right,
@@ -3553,12 +3551,12 @@ mod tests {
35533551
assert!(
35543552
stringified_plans
35553553
.iter()
3556-
.any(|p| matches!(p.plan_type, PlanType::FinalLogicalPlan))
3554+
.any(|p| p.plan_type == PlanType::FinalLogicalPlan)
35573555
);
35583556
assert!(
35593557
stringified_plans
35603558
.iter()
3561-
.any(|p| matches!(p.plan_type, PlanType::InitialPhysicalPlan))
3559+
.any(|p| p.plan_type == PlanType::InitialPhysicalPlan)
35623560
);
35633561
assert!(
35643562
stringified_plans.iter().any(|p| matches!(
@@ -3569,7 +3567,7 @@ mod tests {
35693567
assert!(
35703568
stringified_plans
35713569
.iter()
3572-
.any(|p| matches!(p.plan_type, PlanType::FinalPhysicalPlan))
3570+
.any(|p| p.plan_type == PlanType::FinalPhysicalPlan)
35733571
);
35743572
} else {
35753573
panic!(

datafusion/core/tests/fuzz_cases/aggregate_fuzz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ async fn verify_ordered_aggregate(frame: &DataFrame, expected_sort: bool) {
554554
InputOrderMode::PartiallySorted(_) | InputOrderMode::Sorted
555555
));
556556
} else {
557-
assert!(matches!(exec.input_order_mode(), InputOrderMode::Linear));
557+
assert_eq!(*exec.input_order_mode(), InputOrderMode::Linear);
558558
}
559559
}
560560
Ok(TreeNodeRecursion::Continue)

datafusion/core/tests/fuzz_cases/spilling_fuzz_in_memory_constrained_env.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,11 @@ async fn run_sort_test_with_limited_memory(
278278

279279
let string_item_size =
280280
record_batch_memory_size / record_batch_size as usize;
281-
let string_array = Arc::new(StringArray::from_iter_values(
282-
(0..record_batch_size).map(|_| "a".repeat(string_item_size)),
283-
));
281+
let string_array =
282+
Arc::new(StringArray::from_iter_values(std::iter::repeat_n(
283+
"a".repeat(string_item_size),
284+
record_batch_size as usize,
285+
)));
284286

285287
RecordBatch::try_new(
286288
Arc::clone(&schema),
@@ -536,9 +538,11 @@ async fn run_test_aggregate_with_high_cardinality(
536538

537539
let string_item_size =
538540
record_batch_memory_size / record_batch_size as usize;
539-
let string_array = Arc::new(StringArray::from_iter_values(
540-
(0..record_batch_size).map(|_| "a".repeat(string_item_size)),
541-
));
541+
let string_array =
542+
Arc::new(StringArray::from_iter_values(std::iter::repeat_n(
543+
"a".repeat(string_item_size),
544+
record_batch_size as usize,
545+
)));
542546

543547
RecordBatch::try_new(
544548
Arc::clone(&schema),

datafusion/core/tests/fuzz_cases/window_fuzz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ async fn run_window_test(
589589
orderby_columns: Vec<&str>,
590590
search_mode: InputOrderMode,
591591
) -> Result<()> {
592-
let is_linear = !matches!(search_mode, Sorted);
592+
let is_linear = search_mode != Sorted;
593593
let mut rng = StdRng::seed_from_u64(random_seed);
594594
let schema = input1[0].schema();
595595
let session_config = SessionConfig::new().with_batch_size(50);

0 commit comments

Comments
 (0)