You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2025/01/05 18:07:40 UTC
Re: [PR] Rewrite LogicalPlan::max_rows for Join and Union, made it easier to understand [datafusion]
alamb commented on code in PR #14012:
URL: https://github.com/apache/datafusion/pull/14012#discussion_r1903316252
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1337,17 +1332,12 @@ impl LogicalPlan {
JoinType::RightSemi | JoinType::RightAnti => right.max_rows(),
},
LogicalPlan::Repartition(Repartition { input, .. }) => input.max_rows(),
- LogicalPlan::Union(Union { inputs, .. }) => inputs
- .iter()
- .map(|plan| plan.max_rows())
- .try_fold(0usize, |mut acc, input_max| {
- if let Some(i_max) = input_max {
- acc += i_max;
- Some(acc)
- } else {
- None
- }
- }),
+ LogicalPlan::Union(Union { inputs, .. }) => {
+ inputs.iter().try_fold(0usize, |mut acc, plan| {
+ acc += plan.max_rows()?;
Review Comment:
using `?` to return None is a nice improvement 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org