tisonkun commented on code in PR #10392:
URL: https://github.com/apache/datafusion/pull/10392#discussion_r1617967562


##########
datafusion/sql/src/expr/mod.rs:
##########
@@ -215,11 +216,28 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                         _ => (expr, false),
                     }
                 }
+
                 let expr =
-                    self.sql_expr_to_logical_expr(*obj, schema, 
planner_context)?;
+                    self.sql_expr_to_logical_expr(*expr, schema, 
planner_context)?;
+
+                let indexes = match *subscript {
+                    Subscript::Index { index } => vec![index],
+                    Subscript::Slice { lower_bound, upper_bound } => {
+                        let mut indexes = vec![];
+                        if let Some(lower_bound) = lower_bound {
+                            indexes.push(lower_bound);
+                        }
+                        if let Some(upper_bound) = upper_bound {
+                            indexes.push(upper_bound);
+                        }
+                        indexes
+                    }
+                };

Review Comment:
   Now we pass the compilation. But it still fails `array.slt`:
   
   ```
   External error: query failed: DataFusion error: Error during planning: Error 
during planning: Coercion from [Int64, Int64] to the signature 
ArraySignature(ArrayAndIndex) failed. and No function matches the given name 
and argument types 'array_element(Int64, Int64)'. You might need to add 
explicit type casts.
        Candidate functions:
        array_element(array, index)
   [SQL] select make_array(1, 2, 3)[1:2], make_array(1.0, 2.0, 3.0)[2:3], 
make_array('h', 'e', 'l', 'l', 'o')[2:4];
   at test_files/array.slt:859
   
   Error: Execution("1 failures")
   error: test failed, to rerun pass `-p datafusion-sqllogictest --test 
sqllogictests`
   ```



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to