Dandandan commented on a change in pull request #519:
URL: https://github.com/apache/arrow-datafusion/pull/519#discussion_r646164764
##########
File path: datafusion/src/sql/utils.rs
##########
@@ -390,6 +390,42 @@ pub(crate) fn extract_aliases(exprs: &[Expr]) ->
HashMap<String, Expr> {
.collect::<HashMap<String, Expr>>()
}
+/// Returns mapping of each position (`String`) to the expression (`Expr`) it
is
+/// aliasing.
+pub(crate) fn extract_positions(exprs: &[Expr]) -> HashMap<String, Expr> {
+ let mut position = 0;
+ exprs
+ .iter()
Review comment:
You could use the `enumerate` function here to generate the `position`
values.
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.enumerate
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]