UBarney commented on code in PR #15876:
URL: https://github.com/apache/datafusion/pull/15876#discussion_r2065894121


##########
datafusion/sql/tests/cases/plan_to_sql.rs:
##########
@@ -345,10 +345,10 @@ fn roundtrip_statement_with_dialect_2() -> Result<(), 
DataFusionError> {
 #[test]
 fn roundtrip_statement_with_dialect_3() -> Result<(), DataFusionError> {
     roundtrip_statement_with_dialect_helper!(
-        sql: "select min(ta.j1_id) as j1_min, max(tb.j1_max) from j1 ta, 
(select distinct max(ta.j1_id) as j1_max from j1 ta order by max(ta.j1_id)) tb 
order by min(ta.j1_id) limit 10;",
+        sql: "select min(ta.j1_id) as j1_min, max(tb.j1_max) from j1 ta, 
(select distinct max(ta.j1_id) as j1_max from j1 ta ) tb order by min(ta.j1_id) 
limit 10;",

Review Comment:
   Removed the `ORDER BY` clause.
   
   In the `main` branch, a query structured like the following already failed 
to generate a **valid** plan since it can not figure out sort by `distinct` 
output..
   ```
   > CREATE TABLE t (g INT, o INT );
   0 row(s) fetched. 
   Elapsed 0.020 seconds.
   
   > explain  select DISTINCT max(g) as c from t GROUP by o order by max(g);
   Internal error: Unsupported logical plan: Distinct should be replaced to 
Aggregate.
   This was likely caused by a bug in DataFusion's code and we would welcome 
that you file an bug report in our issue tracker
   > 
   
   ```
   In this PR it will generate error since it try push agg func to `distinct`



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