Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed May 6, 2024
1 parent 2ac315a commit 2cf16d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/planner/core/common_unity.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ func collectUnityInfo(p base.LogicalPlan, o *UnityOutput) {
for _, expr := range x.GroupByItems {
collectColumnFromExpr(expr, o)
}
for _, agg := range x.AggFuncs {
for _, expr := range agg.Args {
collectColumnFromExpr(expr, o)
}
}
case *LogicalSort:
for _, item := range x.ByItems {
collectColumnFromExpr(item.Expr, o)
Expand Down
3 changes: 2 additions & 1 deletion pkg/planner/core/common_unity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ func TestUnity(t *testing.T) {
tk.MustExec(`create table t2 (a int, b int, c int, key(a))`)
tk.MustExec(`create table t3 (a int, b int, c int, key(a))`)
//formatPrint(tk, `explain format='unity' select * from t1, t2 where t1.a=t2.a`)
formatPrint(tk, `explain format='unity' select 1 from t1, t2, t3 where t1.a=t2.a and t2.a=t3.a`)
//formatPrint(tk, `explain format='unity' select 1 from t1, t2, t3 where t1.a=t2.a and t2.a=t3.a`)
formatPrint(tk, `explain format='unity' select max(a) as ma, count(1) from t1`)
}

func formatPrint(tk *testkit.TestKit, sql string) {
Expand Down

0 comments on commit 2cf16d8

Please sign in to comment.