You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "comphead (via GitHub)" <gi...@apache.org> on 2023/03/16 15:02:47 UTC

[GitHub] [arrow-datafusion] comphead commented on a diff in pull request #5618: WITH ORDER support on CREATE EXTERNAL TABLE

comphead commented on code in PR #5618:
URL: https://github.com/apache/arrow-datafusion/pull/5618#discussion_r1138837330


##########
datafusion/sql/src/statement.rs:
##########
@@ -425,6 +425,34 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         }))
     }
 
+    fn build_order_by(
+        &self,
+        order_exprs: Vec<OrderByExpr>,
+        schema: &DFSchemaRef,
+    ) -> Result<Vec<datafusion_expr::Expr>> {
+        // Convert each OrderByExpr to a SortExpr:
+        let result = order_exprs
+            .into_iter()
+            .map(|e| self.order_by_to_sort_expr(e, schema))
+            .collect::<Result<Vec<_>>>()?;
+
+        // Verify that columns of all SortExprs exist in the schema:
+        for expr in result.iter() {

Review Comment:
   nit: do we really need to loop twice 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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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