@@ -5362,9 +5362,6 @@ func isColumnMatchedALeftMostPrefix(allCols []string, colsWithEQ, colsWithOr []s
53625362 multiConstraints := make ([]* ast.Constraint , 0 )
53635363 for _ , constraint := range constraints {
53645364 if len (constraint .Keys ) == 1 {
5365- if checkSingleIndex (allCols , constraint ) {
5366- return true
5367- }
53685365 continue
53695366 }
53705367 multiConstraints = append (multiConstraints , constraint )
@@ -5393,6 +5390,16 @@ func isColumnMatchedALeftMostPrefix(allCols []string, colsWithEQ, colsWithOr []s
53935390 return true
53945391}
53955392
5393+ func checkSingleIndex (allCols []string , constraint * ast.Constraint ) bool {
5394+ singleIndexColumn := constraint .Keys [0 ].Column .Name .L
5395+ for _ , col := range allCols {
5396+ if col == singleIndexColumn {
5397+ return true
5398+ }
5399+ }
5400+ return false
5401+ }
5402+
53965403func isColumnUseLeftMostPrefix (allCols []string , constraints []* ast.Constraint ) bool {
53975404 multiConstraints := make ([]* ast.Constraint , 0 )
53985405 for _ , constraint := range constraints {
@@ -5429,16 +5436,6 @@ func isColumnUseLeftMostPrefix(allCols []string, constraints []*ast.Constraint)
54295436 return true
54305437}
54315438
5432- func checkSingleIndex (allCols []string , constraint * ast.Constraint ) bool {
5433- singleIndexColumn := constraint .Keys [0 ].Column .Name .L
5434- for _ , col := range allCols {
5435- if col == singleIndexColumn {
5436- return true
5437- }
5438- }
5439- return false
5440- }
5441-
54425439func checkJoinFieldUseIndex (input * RuleHandlerInput ) error {
54435440 isUsingIndex , err := judgeJoinFieldUseIndex (input )
54445441 if err == nil && ! isUsingIndex {
0 commit comments