MartijnVisser opened a new pull request, #29334:
URL: https://github.com/apache/flink/pull/29334
## What is the purpose of the change
Follow-up to #29333; the first two commits are that PR's. The client printed
the deepest cause of an error, which for parse and validation errors is a
Calcite class with the bare text, so the position the planner now adds never
reached the terminal. The client now prints the outermost exception whose
message ends with the root cause's message, in the in-JVM chain, in verbose
mode and in the `Caused by:` segments of a gateway stack trace: `ELECT 1;`
prints `SqlParserException: SQL parse failed. From line 1, column 1 to line 1,
column 5: Non-query expression encountered in illegal context` instead of
`CalciteException: Non-query expression encountered in illegal context`.
Validation errors and `LOAD`/`USE`/`UNLOAD MODULE` failures change the same
way; anything no wrapper prefixes is unchanged, including planning rejections,
which put the plan after the reason. A computed column that fails validation
now prints the `CalciteContextException` line with the position instead of the
bare
`SqlValidatorException` line, since `ParserImpl#parseSqlExpression` does not
quote its cause; showing the Flink class there is a follow-up.
## Brief change log
- `CliStrings#messageError` picks the outermost exception that ends with
the root cause's message, in the chain and in the `RestClientException` text,
also in verbose mode
- the `Caused by:` split is anchored at line start and stops at the first
frame line
- a cycle in the cause chain no longer hangs the client
## Verifying this change
This change added tests and can be verified as follows:
- Added `CliStringsTest`: six cases red on the planner-only head, seven
that pin today's behavior, one cycle case that hangs without the change
- `CliClientITCase`: fourteen golden blocks change and `select.q` gains
`ELECT 1;`, the same behind a comment, `SELECT * FROM (t);` and a streaming
`ORDER BY` rejection, all copied from the run
- `ScriptExecutorITCase` and `SqlGatewayServiceStatementITCase` pass
unchanged
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Claude Fable 5.1)
--
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]