jychen7 commented on a change in pull request #519:
URL: https://github.com/apache/arrow-datafusion/pull/519#discussion_r646695820
##########
File path: datafusion/src/sql/utils.rs
##########
@@ -390,6 +391,29 @@ pub(crate) fn extract_aliases(exprs: &[Expr]) ->
HashMap<String, Expr> {
.collect::<HashMap<String, Expr>>()
}
+pub(crate) fn resolve_positions_to_exprs(
+ expr: &Expr,
+ select_exprs: &[Expr],
+) -> Result<Expr> {
+ match expr {
+ // sql_expr_to_logical_expr maps number to i64
+ //
https://github.com/apache/arrow-datafusion/blob/8d175c759e17190980f270b5894348dc4cff9bbf/datafusion/src/sql/planner.rs#L882-L887
+ Expr::Literal(ScalarValue::Int64(Some(pos))) => {
Review comment:
thanks, will combine the `if` with `match`, though it maybe a bit longer
due to type cast. Also will add test cases mention above. They are great valid
test cases
```
Expr::Literal(ScalarValue::Int64(Some(position)))
if position > &(0 as i64) && position <= &(select_exprs.len() as
i64)
```
--
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]