PhVHoang commented on code in PR #9202:
URL: https://github.com/apache/arrow-datafusion/pull/9202#discussion_r1486375492


##########
datafusion/sql/src/expr/function.rs:
##########
@@ -149,18 +149,37 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             )?;
 
             let func_deps = schema.functional_dependencies();
-            // Find whether ties are possible in the given ordering:
-            let is_ordering_strict = order_by.iter().any(|orderby_expr| {
+            // Find whether ties are possible in the given ordering
+            let is_ordering_strict = order_by.iter().find_map(|orderby_expr| {
                 if let Expr::Sort(sort_expr) = orderby_expr {
                     if let Expr::Column(col) = sort_expr.expr.as_ref() {
-                        let idx = schema.index_of_column(col).unwrap();
-                        return func_deps.iter().any(|dep| {
+                        let idx_result = schema.index_of_column(col);
+
+                        // Propagate the error to the caller and return it 
immediately
+                        let idx = idx_result

Review Comment:
   Thank you very much for your suggestion. Yes it's way simpler than that of 
mine. 
   
   Fixed. 



-- 
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]

Reply via email to