qstommyshu commented on code in PR #15548: URL: https://github.com/apache/datafusion/pull/15548#discussion_r2025673832
########## datafusion/sql/tests/sql_integration.rs: ########## @@ -2928,37 +3062,74 @@ fn select_groupby_orderby() { date_trunc('month', birth_date) AS "birth_date" FROM person GROUP BY birth_date ORDER BY birth_date; "#; - // expect that this is not an ambiguous reference - let expected = - "Sort: birth_date ASC NULLS LAST\ - \n Projection: avg(person.age) AS value, date_trunc(Utf8(\"month\"), person.birth_date) AS birth_date\ - \n Aggregate: groupBy=[[person.birth_date]], aggr=[[avg(person.age)]]\ - \n TableScan: person"; - quick_test(sql, expected); + + let plan = generate_logical_plan(sql); + assert_snapshot!( + plan, + // expect that this is not an ambiguous reference + @r#" +Sort: birth_date ASC NULLS LAST + Projection: avg(person.age) AS value, date_trunc(Utf8("month"), person.birth_date) AS birth_date + Aggregate: groupBy=[[person.birth_date]], aggr=[[avg(person.age)]] + TableScan: person +"# + ); // Use fully qualified `person.birth_date` as argument to date_trunc, plan should be the same let sql = r#"SELECT avg(age) AS "value", date_trunc('month', person.birth_date) AS "birth_date" FROM person GROUP BY birth_date ORDER BY birth_date; "#; - quick_test(sql, expected); + let plan = generate_logical_plan(sql); + assert_snapshot!( + plan, + // expect that this is not an ambiguous reference + @r#" +Sort: birth_date ASC NULLS LAST + Projection: avg(person.age) AS value, date_trunc(Utf8("month"), person.birth_date) AS birth_date + Aggregate: groupBy=[[person.birth_date]], aggr=[[avg(person.age)]] + TableScan: person +"# + ); // Use fully qualified `person.birth_date` as group by, plan should be the same let sql = r#"SELECT avg(age) AS "value", date_trunc('month', birth_date) AS "birth_date" FROM person GROUP BY person.birth_date ORDER BY birth_date; "#; - quick_test(sql, expected); + + let plan = generate_logical_plan(sql); + assert_snapshot!( + plan, + // expect that this is not an ambiguous reference + @r#" +Sort: birth_date ASC NULLS LAST + Projection: avg(person.age) AS value, date_trunc(Utf8("month"), person.birth_date) AS birth_date Review Comment: done, refactored with `allow_duplicates!` -- 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