Skip to content

Commit

Permalink
feat: fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillKurdyukov committed Aug 20, 2024
1 parent ea0adf5 commit 7c3b150
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class IndexQueryHintHandler {
private static final Pattern SELECT_FROM_WHERE_QUERY_PATTERN = Pattern
.compile("^\\s*(select.+?from\\s+\\w+)(.+where.+)$", Pattern.CASE_INSENSITIVE);

public static final String HINT_USE_INDEX = "use_index";
public static final String HINT_USE_INDEX = "use_index:";
public static final IndexQueryHintHandler INSTANCE = new IndexQueryHintHandler();

public String addQueryHints(String query, List<String> hints) {
Expand All @@ -22,9 +22,8 @@ public String addQueryHints(String query, List<String> hints) {

var useIndexes = new ArrayList<String>();
hints.forEach(hint -> {
var hintSplit = hint.split(":");
if (hintSplit.length == 2 && hintSplit[0].equals(HINT_USE_INDEX)) {
useIndexes.add(hintSplit[1]);
if (hint.startsWith(HINT_USE_INDEX)) {
useIndexes.add(hint.substring(HINT_USE_INDEX.length()));
}
});

Expand Down

0 comments on commit 7c3b150

Please sign in to comment.