manner opened a new pull request, #29906:
URL: https://github.com/apache/flink/pull/29906

   ## What is the purpose of the change
   
   This is the first PR for 
[FLIP-620](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=462815815).
 It adds the error infrastructure to `flink-core-api` and `flink-core` and uses 
it for the first Table API and SQL errors: tables, views and materialized 
tables that don't exist, and tables or views that already exist. More errors 
will follow in later PRs.
   
   ## Brief change log
   
     - Add `FlinkError`, `ErrorCategory`, `ErrorAttribute` and `FlinkThrowable` 
to `flink-core-api`. A component declares its errors as an enum that implements 
`FlinkError`. Each error has a stable name, a category, attributes and a 
message template with typed parameters. `getRedactedMessage()` replaces the 
arguments of sensitive parameters, so the message can go into logs.
     - `FlinkRuntimeException` and `FlinkException` implement `FlinkThrowable` 
and get constructors that take an error and its arguments. The constructors 
check that the error is an enum constant and that the arguments match its 
parameters. If a check fails, the `IllegalArgumentException` keeps the cause.
     - Add `FlinkErrorTestUtils` to the `flink-core` test-jar, so every 
component can test its error enum the same way.
     - Add `TableError` with `TABLE_OR_VIEW_NOT_FOUND`, `TABLE_NOT_FOUND`, 
`VIEW_NOT_FOUND`, `MATERIALIZED_TABLE_NOT_FOUND` and 
`TABLE_OR_VIEW_ALREADY_EXISTS`. The message of a table error ends with its 
SQLSTATE.
     - `TableException`, `ValidationException` and `CatalogException` now 
extend `FlinkRuntimeException`, and `TableNotExistException` and 
`TableAlreadyExistException` now extend `FlinkException`. Existing catch blocks 
keep working. The five classes pin the `serialVersionUID` that Java computed 
for them in 2.3.0 (the `serialver` output), so exceptions serialized by 2.3.0 
can still be read.
     - `TableNotExistException` and `TableAlreadyExistException` carry 
`TABLE_OR_VIEW_NOT_FOUND` and `TABLE_OR_VIEW_ALREADY_EXISTS`. Catalogs that 
throw them get the errors without changes.
     - `DROP TABLE`, `DROP VIEW` and `DROP MATERIALIZED TABLE` on a missing 
object throw `TABLE_NOT_FOUND`, `VIEW_NOT_FOUND` and 
`MATERIALIZED_TABLE_NOT_FOUND`. If an object of another kind exists, such as on 
`DROP TABLE` for a view, the free-text message stays.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - `FlinkErrorTest` covers template formatting, redaction and argument and 
parameter validation.
     - `FlinkThrowableTest` covers the exceptions created from an error, 
free-text exceptions, `is`, `findCause` and the static helpers, and 
serialization.
     - `TableErrorTest` checks `TableError` with `FlinkErrorTestUtils`.
     - `CatalogManagerTest` covers the errors of the three DROP statements and 
the free-text message for an object of another kind.
     - Updated the expected messages in `CatalogTest`, `TableEnvironmentTest`, 
the SQL client and SQL gateway `.q` files, `MaterializedTableStatementITCase` 
and `MaterializedTableTableApiITCase`.
   
   ## 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)`: yes. It adds new `@PublicEvolving` interfaces in 
`flink-core-api` and new `@PublicEvolving` constructors on `FlinkException`, 
`FlinkRuntimeException` and the table exceptions, as described in FLIP-620. The 
table exceptions get a new superclass, and the messages of missing and existing 
tables change.
     - 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? yes
     - If yes, how is the feature documented? JavaDocs. The message changes go 
into the release note on the JIRA ticket.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Claude Opus 5.5)


-- 
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]

Reply via email to