epsio-banay commented on code in PR #13039: URL: https://github.com/apache/datafusion/pull/13039#discussion_r1810604241
########## datafusion/expr/src/logical_plan/plan.rs: ########## @@ -3870,6 +3873,39 @@ digraph { ); } + #[test] + fn distinct_on_expr_order_by_mismatch() -> Result<()> { + let schema = Schema::new(vec![ + Field::new("a", DataType::Int32, false), + Field::new("b", DataType::Int32, false), + ]); + + let table_scan = table_scan(TableReference::none(), &schema, None)?.build()?; + let p = DistinctOn::try_new( + vec![col("a")], + vec![], + Some(vec![SortExpr::new(col("b"), true, false)]), + Arc::new(table_scan), + ); + assert_eq!(p.err().unwrap().strip_backtrace(), "Error during planning: SELECT DISTINCT ON expressions must match initial ORDER BY expressions"); + Ok(()) + } + + #[test] + fn distinct_on_expr_order_by_match() -> Result<()> { Review Comment: I changed the tests. marking as resolved -- 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