diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 9f03a3cf40..983dc9cac3 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -2626,6 +2626,15 @@ func (s *testIntegrationSuite) TestIssue22199(c *C) { tk.MustGetErrMsg("select t1.*, (select t2.* from t1) from t1", "[planner:1051]Unknown table 't2'") } +func (s *testIntegrationSuite) TestIssue22892(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustExec("use test") + tk.MustExec("drop table if exists t1") + tk.MustExec("create table t1(a int) partition by hash (a) partitions 5;") + tk.MustExec("insert into t1 values (0);") + tk.MustQuery("select * from t1 where a not between 1 and 2;").Check(testkit.Rows("0")) +} + func (s *testIntegrationSerialSuite) TestPushDownProjectionForTiFlash(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") diff --git a/util/ranger/points.go b/util/ranger/points.go index 26359213f5..cf2356af92 100644 --- a/util/ranger/points.go +++ b/util/ranger/points.go @@ -638,6 +638,8 @@ func (r *builder) buildFromNot(expr *expression.ScalarFunction) []*point { startPoint := &point{value: types.MinNotNullDatum(), start: true} endPoint := &point{value: types.MaxValueDatum()} return []*point{startPoint, endPoint} + case ast.LogicAnd: + return r.intersection(r.build(expr.GetArgs()[0]), r.build(expr.GetArgs()[1])) } return nil }