From 4af70e7af7812ad31a1f2a925e78a3b8f5116cbf Mon Sep 17 00:00:00 2001 From: yisaer Date: Mon, 28 Nov 2022 13:33:41 +0800 Subject: [PATCH] fix test Signed-off-by: yisaer --- planner/core/find_best_task.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index 04d986719bd60..ed21618fbdd94 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -1062,11 +1062,14 @@ func (ds *DataSource) isPointGetPath(path *util.AccessPath) bool { if len(path.Ranges) < 1 { return false } - if path.Index.HasPrefixIndex() { - return false - } - if !path.IsIntHandlePath && !path.Index.Unique { - return false + if path.Index != nil { + if path.Index.HasPrefixIndex() || !path.Index.Unique { + return false + } + } else { + if !path.IsIntHandlePath { + return false + } } idxColsLen := len(path.Index.Columns) for _, ran := range path.Ranges { @@ -1077,7 +1080,6 @@ func (ds *DataSource) isPointGetPath(path *util.AccessPath) bool { allRangeIsPoint := true for _, ran := range path.Ranges { if !ran.IsPointNonNullable(ds.ctx) { - // unique indexes can have duplicated NULL rows so we cannot use PointGet if there is NULL allRangeIsPoint = false break }