Skip to content

Commit 44c3089

Browse files
committed
update
1 parent c14975f commit 44c3089

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

datafusion/core/tests/physical_optimizer/partition_statistics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ mod test {
14521452
},
14531453
],
14541454
};
1455-
assert_eq!(statistics[0], expected_p0_statistics);
1455+
assert_eq!(*statistics[0], expected_p0_statistics);
14561456

14571457
// Test Partitioned mode
14581458
let partitioned_join = Arc::new(HashJoinExec::try_new(
@@ -1526,7 +1526,7 @@ mod test {
15261526
},
15271527
],
15281528
};
1529-
assert_eq!(statistics[0], expected_p0_statistics);
1529+
assert_eq!(*statistics[0], expected_p0_statistics);
15301530

15311531
// Test Auto mode - should fall back to getting all partition statistics
15321532
let auto_join = Arc::new(HashJoinExec::try_new(
@@ -1600,7 +1600,7 @@ mod test {
16001600
},
16011601
],
16021602
};
1603-
assert_eq!(statistics[0], expected_p0_statistics);
1603+
assert_eq!(*statistics[0], expected_p0_statistics);
16041604
Ok(())
16051605
}
16061606
}

datafusion/physical-plan/src/execution_plan.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,10 @@ mod tests {
17811781
unimplemented!()
17821782
}
17831783

1784-
fn partition_statistics(&self, _partition: Option<usize>) -> Result<Statistics> {
1784+
fn partition_statistics(
1785+
&self,
1786+
_partition: Option<usize>,
1787+
) -> Result<Arc<Statistics>> {
17851788
unimplemented!()
17861789
}
17871790
}

datafusion/physical-plan/src/joins/hash_join/exec.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ impl ExecutionPlan for HashJoinExec {
14411441
Some(self.metrics.clone_inner())
14421442
}
14431443

1444-
fn partition_statistics(&self, partition: Option<usize>) -> Result<Statistics> {
1444+
fn partition_statistics(&self, partition: Option<usize>) -> Result<Arc<Statistics>> {
14451445
let stats = match (partition, self.mode) {
14461446
// For CollectLeft mode, the left side is collected into a single partition,
14471447
// so all left partitions are available to each output partition.
@@ -1451,8 +1451,8 @@ impl ExecutionPlan for HashJoinExec {
14511451
let right_stats = self.right.partition_statistics(Some(partition))?;
14521452

14531453
estimate_join_statistics(
1454-
left_stats,
1455-
right_stats,
1454+
(*left_stats).clone(),
1455+
(*right_stats).clone(),
14561456
&self.on,
14571457
&self.join_type,
14581458
&self.join_schema,
@@ -1466,8 +1466,8 @@ impl ExecutionPlan for HashJoinExec {
14661466
let right_stats = self.right.partition_statistics(Some(partition))?;
14671467

14681468
estimate_join_statistics(
1469-
left_stats,
1470-
right_stats,
1469+
(*left_stats).clone(),
1470+
(*right_stats).clone(),
14711471
&self.on,
14721472
&self.join_type,
14731473
&self.join_schema,
@@ -1480,9 +1480,11 @@ impl ExecutionPlan for HashJoinExec {
14801480
// TODO stats: it is not possible in general to know the output size of joins
14811481
// There are some special cases though, for example:
14821482
// - `A LEFT JOIN B ON A.col=B.col` with `COUNT_DISTINCT(B.col)=COUNT(B.col)`
1483+
let left_stats = self.left.partition_statistics(None)?;
1484+
let right_stats = self.right.partition_statistics(None)?;
14831485
estimate_join_statistics(
1484-
self.left.partition_statistics(None)?,
1485-
self.right.partition_statistics(None)?,
1486+
(*left_stats).clone(),
1487+
(*right_stats).clone(),
14861488
&self.on,
14871489
&self.join_type,
14881490
&self.join_schema,

docs/source/library-user-guide/upgrading/54.0.0.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn apply_expressions(
7777

7878
**Node whose only expressions are in `output_ordering()` (e.g. a synthetic test node with no owned expression fields):**
7979

80-
````rust,ignore
80+
```rust,ignore
8181
fn apply_expressions(
8282
&self,
8383
f: &mut dyn FnMut(&dyn PhysicalExpr) -> Result<TreeNodeRecursion>,
@@ -90,6 +90,7 @@ fn apply_expressions(
9090
}
9191
Ok(tnr)
9292
}
93+
9394
### `ExecutionPlan::partition_statistics` now returns `Arc<Statistics>`
9495
9596
`ExecutionPlan::partition_statistics` now returns `Result<Arc<Statistics>>` instead of `Result<Statistics>`. This avoids cloning `Statistics` when it is shared across multiple consumers.
@@ -100,7 +101,7 @@ fn apply_expressions(
100101
fn partition_statistics(&self, partition: Option<usize>) -> Result<Statistics> {
101102
Ok(Statistics::new_unknown(&self.schema()))
102103
}
103-
````
104+
```
104105

105106
**After:**
106107

0 commit comments

Comments
 (0)