Repository navigation
IGNITE-12381 SQL: Propagate H2 error codes to IgniteSQLException - #13719
Open
XianReallyHot-ZZH wants to merge 2 commits into
Open
XianReallyHot-ZZH wants to merge 2 commits into
XianReallyHot-ZZH wants to merge 2 commits into
Conversation
Author
|
The branch is rebased onto the latest master, which includes the fix for the ducktape GitHub checks failing on Ubuntu 26.04 runners (#13728). Could a committer please approve the workflow run so the checks can be re-verified on the new runner configuration? Many thanks! |
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.
Ticket: IGNITE-12381
What changes
H2Connection.prepareStatement()/prepareStatementNoCache()and theSQLExceptioncatch inQueryParser#parseH2wrapped every H2 error intoIgniteSQLExceptionwith the genericIgniteQueryErrorCode.PARSINGcode, so a client could not distinguish, say, a missing table from a plain syntax error without parsing the message text.This adds
H2Utils.h2ErrorCode(int)mapping the H2 error codes that have a direct Ignite counterpart, and uses it at all three wrap sites:TABLE_OR_VIEW_NOT_FOUND_1(42102)TABLE_NOT_FOUNDTABLE_OR_VIEW_ALREADY_EXISTS_1(42101)TABLE_ALREADY_EXISTSCOLUMN_NOT_FOUND_1(42122)COLUMN_NOT_FOUNDDUPLICATE_COLUMN_NAME_1(42121)COLUMN_ALREADY_EXISTSINDEX_ALREADY_EXISTS_1(42111)INDEX_ALREADY_EXISTSINDEX_NOT_FOUND_1(42112)INDEX_NOT_FOUNDSCHEMA_NOT_FOUND_1(90079)SCHEMA_NOT_FOUNDAll other codes keep the default
PARSING. Error messages are unchanged, and so are SQL states — every mapped code already resolves toSqlStateCode.PARSING_EXCEPTIONinIgniteQueryErrorCode#codeToSqlState, so only the integer error code visible through JDBC/ODBC becomes more specific. The change affects the H2 engine path (ignite-indexing) only; the default Calcite engine is untouched.Testing
New
testParseErrorCodesinIgniteCacheSqlQueryErrorSelfTest(modules/indexing) assertsIgniteSQLException.statusCode()for selects and DML against missing tables, a missing column, a missing schema, and that a pure syntax error still yieldsPARSING. All existing message assertions in that class pass unchanged, as doJdbcErrorsSelfTestandJdbcThinErrorsSelfTest(modules/clients, 75 tests).