Skip to content

Commit 7c3b150

Browse files
feat: fix issue
1 parent ea0adf5 commit 7c3b150

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

hibernate-dialect/src/main/java/tech/ydb/hibernate/dialect/hint/IndexQueryHintHandler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class IndexQueryHintHandler {
1212
private static final Pattern SELECT_FROM_WHERE_QUERY_PATTERN = Pattern
1313
.compile("^\\s*(select.+?from\\s+\\w+)(.+where.+)$", Pattern.CASE_INSENSITIVE);
1414

15-
public static final String HINT_USE_INDEX = "use_index";
15+
public static final String HINT_USE_INDEX = "use_index:";
1616
public static final IndexQueryHintHandler INSTANCE = new IndexQueryHintHandler();
1717

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

2323
var useIndexes = new ArrayList<String>();
2424
hints.forEach(hint -> {
25-
var hintSplit = hint.split(":");
26-
if (hintSplit.length == 2 && hintSplit[0].equals(HINT_USE_INDEX)) {
27-
useIndexes.add(hintSplit[1]);
25+
if (hint.startsWith(HINT_USE_INDEX)) {
26+
useIndexes.add(hint.substring(HINT_USE_INDEX.length()));
2827
}
2928
});
3029

0 commit comments

Comments
 (0)