jychen7 commented on a change in pull request #519:
URL: https://github.com/apache/arrow-datafusion/pull/519#discussion_r646195579



##########
File path: datafusion/src/sql/utils.rs
##########
@@ -390,6 +391,30 @@ 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 {
+        Expr::Literal(position) => match position {
+            ScalarValue::Int64(Some(pos)) => {

Review comment:
       @Dandandan do you think we should handle other Integer and unsigned 
integer types?
   
   if so, do you know how we can make the code DRY? since following raise type 
error
   ```
   Expr::Literal(position) => match position {
       |                                          -------- this expression has 
type `&scalar::ScalarValue`
   400 |             ScalarValue::UInt64(Some(pos)) | 
ScalarValue::Int64(Some(pos)) => {
       |                                      ---                             
^^^ expected `u64`, found `i64`
       |                                      |
       |                                      first introduced with type `&u64` 
here
   ```




-- 
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:
us...@infra.apache.org


Reply via email to