jonahgao commented on code in PR #15135:
URL: https://github.com/apache/datafusion/pull/15135#discussion_r1993697044


##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -776,8 +777,32 @@ impl LogicalPlanBuilder {
             &missing_cols,
             is_distinct,
         )?;
+
+        let mut sort_exprs = normalize_sorts(sorts, &plan)?;
+        if matches!(&plan, LogicalPlan::Union(_))

Review Comment:
   Why do we need this? It seems to make the following invalid query executable.
   ```sh
   DataFusion CLI v46.0.0
   > create table t1(a int);
   0 row(s) fetched.
   Elapsed 0.007 seconds.
   
   > create table t2(a int);
   0 row(s) fetched.
   Elapsed 0.007 seconds.
   
   > select t1.a from t1 union all select t2.a from t2 order by 
not_exist_table.a;
   +---+
   | a |
   +---+
   +---+
   0 row(s) fetched.
   Elapsed 0.008 seconds.
   ```



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