ygf11 opened a new issue, #4152: URL: https://github.com/apache/arrow-datafusion/issues/4152
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** Currently we use [expr_to_columns](https://github.com/apache/arrow-datafusion/blob/master/datafusion/expr/src/utils.rs) to collect referenced columns from an expression. The usage is like: ```rust let mut using_columns = HashSet::new(); expr_to_columns(expr, &mut using_columns)?; ``` It is not easy to use, because we need create a new `HashSet` everytime we invoke it. And the most usages of it is to collect from an single expression. **Describe the solution you'd like** Add a new method to `Expr` for collecting columns, like: ```rust pub fn to_columns(&self) -> Result<HashSet<Column>> { let mut using_columns = HashSet::new(); expr_to_columns(self, &mut using_columns)?; Ok(using_columns) } ``` The usage will be like: ```rust let using_columns = expr.to_columns()?; ... ``` **Describe alternatives you've considered** **Additional context** -- 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]
