XianReallyHot-ZZH opened a new pull request, #13762: URL: https://github.com/apache/ignite/pull/13762
Ticket: https://issues.apache.org/jira/browse/IGNITE-10424 ### Problem When a distributed SQL query fails on a map node (e.g. numeric overflow in `SELECT SUM(field2 * 1000000000)` on an int column), the client receives a bare `javax.cache.CacheException: Failed to execute map query on remote node [...]` with no `IgniteSQLException` in the cause chain. Ignite 2.4 surfaced `SqlException: Numeric value out of range`; the regression appeared in 2.5. Root cause: `GridMapQueryExecutor.sendError()` collapses the map-side throwable into `GridQueryFailResponse`, which carries only the error message string and a fail code (cancel/retry). The `IgniteSQLException` type and its status code are lost on the wire, so `GridReduceQueryExecutor.fail()` cannot reconstruct it and builds a causeless `CacheException`. This also degrades thin JDBC clients: `JdbcRequestHandler` already unwraps `IgniteSQLException` via `X.cause(...)`, but finds nothing. ### Fix * `GridQueryFailResponse` gets a rolling-upgrade gated `int statusCode` field (`@Order(value = 3, introducedBy = "QUERY_FAIL_RESPONSE_ERROR_CODE_FEATURE")`, new feature in `CoreFeatureRegistry`), populated from `X.cause(err, IgniteSQLException.class).statusCode()` on the map node. * `GridReduceQueryExecutor.fail()` reconstructs `new CacheException(mapperFailedMsg, new IgniteSQLException(msg, statusCode))` when a status code is present — mirroring the existing cancel/retry branches. `CacheException` stays the top-level type for compatibility; the existing thin-JDBC unwrap picks the SQL error up with no changes above this point. * Old nodes (without the feature) keep today's behavior — the gated field is simply not written/read, `statusCode` stays `0`. ### Test New `IgniteCacheDistributedSqlQueryErrorSelfTest` (2 topologies, red → green on this branch): * `testRemoteMapperFailure` — 1 server + 1 client, query from the client, error travels the marshalled `TOPIC_QUERY` path; * `testLocalMapperFailure` — single node, exercises the local `sendError` → `onFail` hand-off. Both assert the client-visible `CacheException` carries an `IgniteSQLException` cause with the original H2 message ("Numeric value out of range"). Verified locally on JDK 17: the new tests, `IgniteCacheSqlQueryErrorSelfTest`, `SqlStatisticsUserQueriesLongTest`, `JdbcThinErrorsSelfTest` (39 tests) and checkstyle all pass. ### Notes / follow-ups * Calcite is not affected (its exchange marshals full throwables). * The DML error path (`GridH2DmlResponse`) is equally string-only — left as a follow-up. * H2 runtime error codes (e.g. 22003) are currently wrapped as `IgniteQueryErrorCode.UNKNOWN` on the map node; richer mapping is future work (ties into the H2 error-code propagation effort). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
