Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Oct 30, 2023
1 parent f9f6bb3 commit 15921e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2529,6 +2529,15 @@ func TestIssue46298(t *testing.T) {
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;")
}

func TestIssue45044(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec(`use test`)
tk.MustExec(`set tidb_enable_ordered_result_mode = on`)
tk.MustExec(`create table t1(c1 int)`)
tk.MustQuery(`select * from t1 group by t1.c1 having count(1) > 1 order by count(1) limit 10`).Check(testkit.Rows()) // no error
}

// https://github.com/pingcap/tidb/issues/41458
func TestIssue41458(t *testing.T) {
store := testkit.CreateMockStore(t)
Expand Down
3 changes: 3 additions & 0 deletions pkg/planner/core/rule_result_reorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ func (rs *resultReorder) extractHandleCol(lp LogicalPlan) *expression.Column {
switch x := lp.(type) {
case *LogicalSelection, *LogicalLimit:
handleCol := rs.extractHandleCol(lp.Children()[0])
if handleCol == nil {
return nil // fail to extract handle column from the child, just return nil.
}
if x.Schema().Contains(handleCol) {
// some Projection Operator might be inlined, so check the column again here
return handleCol
Expand Down

0 comments on commit 15921e3

Please sign in to comment.