jayzhan211 commented on code in PR #26474:
URL: https://github.com/apache/datafusion/pull/26474#discussion_r4357388086
##########
datafusion/expr/src/utils.rs:
##########
@@ -880,11 +876,19 @@ fn find_exprs_in_expr<F>(expr: &Expr, test_fn: &F) ->
Vec<Expr>
where
F: Fn(&Expr) -> bool,
{
- let mut exprs = vec![];
+ let mut found = IndexSet::new();
+ collect_exprs_in_expr(expr, test_fn, &mut found);
+ found.into_iter().collect()
Review Comment:
nit: this can just delegate to `find_exprs_in_exprs`, which leaves one place
that builds the set:
```diff
- let mut found = IndexSet::new();
- collect_exprs_in_expr(expr, test_fn, &mut found);
- found.into_iter().collect()
+ find_exprs_in_exprs(std::iter::once(expr), test_fn)
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]