Extend use_index hint with table/column-aware format#227
Open
KirillKurdyukov wants to merge 5 commits into
Open
Extend use_index hint with table/column-aware format#227KirillKurdyukov wants to merge 5 commits into
KirillKurdyukov wants to merge 5 commits into
Conversation
0d8374e to
d942ba9
Compare
Extend the use_index hint with a table- and column-aware format `use_index:<index>:<table>(<col>[,<col>...])` so the same table joined several times under different aliases can be pinned to different secondary indexes via VIEW. For each FROM/JOIN of the table the index is applied only when every listed column is referenced by that alias in the relevant scope (ON for a JOIN, WHERE for the FROM table); when several hints fully match, the most specific one (most columns) wins. Also: - SqlTopLevelClauseScanner: single-pass clause lexer (string literals, comments, parenthesis nesting) in the same style as YdbQueryParser — replaces regex clause splitting for correct top-level FROM/JOIN detection. - YdbDialect: pass all hints of a handler in a single batch for the HINT_COMMENT path, so best-match-wins behaves the same as via Query#addQueryHint. - IndexQueryHintHandler: document regexes, fix IDENT grouping for quoted FROM tables, keep v6/v7 in sync. - Add JaCoCo to both modules. - Tests: unit cases (two joins, best-match, partial composite, lexer edge cases) and integration tests (BankDocument model) asserting rewritten SQL via StatementInspector through addQueryHint and HINT_COMMENT paths. Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
447a6e6 to
4a6780f
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
Detect Hibernate-generated SQL by numbered aliases (e.g. a1_0) and skip hint handlers for native queries where VIEW can be written explicitly. Add integration test for addQueryHint and HINT_COMMENT on native SQL. Co-authored-by: Cursor <cursoragent@cursor.com>
This reverts commit a92b46e.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.