Skip to content

Commit 15921e3

Browse files
committed
fixup
1 parent f9f6bb3 commit 15921e3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/planner/core/integration_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,6 +2529,15 @@ func TestIssue46298(t *testing.T) {
25292529
tk.MustQuery("select *, first_value(v) over (partition by p order by o range between 3.1 preceding and 2.9 following) as a from test.first_range;")
25302530
}
25312531

2532+
func TestIssue45044(t *testing.T) {
2533+
store := testkit.CreateMockStore(t)
2534+
tk := testkit.NewTestKit(t, store)
2535+
tk.MustExec(`use test`)
2536+
tk.MustExec(`set tidb_enable_ordered_result_mode = on`)
2537+
tk.MustExec(`create table t1(c1 int)`)
2538+
tk.MustQuery(`select * from t1 group by t1.c1 having count(1) > 1 order by count(1) limit 10`).Check(testkit.Rows()) // no error
2539+
}
2540+
25322541
// https://github.com/pingcap/tidb/issues/41458
25332542
func TestIssue41458(t *testing.T) {
25342543
store := testkit.CreateMockStore(t)

pkg/planner/core/rule_result_reorder.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ func (rs *resultReorder) extractHandleCol(lp LogicalPlan) *expression.Column {
107107
switch x := lp.(type) {
108108
case *LogicalSelection, *LogicalLimit:
109109
handleCol := rs.extractHandleCol(lp.Children()[0])
110+
if handleCol == nil {
111+
return nil // fail to extract handle column from the child, just return nil.
112+
}
110113
if x.Schema().Contains(handleCol) {
111114
// some Projection Operator might be inlined, so check the column again here
112115
return handleCol

0 commit comments

Comments
 (0)