dangzitou opened a new pull request, #4430: URL: https://github.com/apache/flink-cdc/pull/4430
## What this PR does Replaces bare `Optional.get()` calls with `Optional.orElseThrow()` in the Kafka and StarRocks pipeline connectors to provide meaningful error messages when primary key columns are missing from the schema. ### Affected files - `CsvSerializationSchema.java` — CSV serialization primary key lookup - `JsonSerializationSchema.java` — JSON serialization primary key lookup - `StarRocksUtils.java` — StarRocks primary key column ordering ### Why `Optional.get()` throws a bare `NoSuchElementException` with no context when the Optional is empty. This makes debugging difficult when a primary key column is unexpectedly missing (e.g., after schema evolution). Using `orElseThrow()` with a descriptive message including the column name makes failures immediately diagnosable. ## Testing Behavioral change only in the error path — happy-path behavior is unchanged. --- Split from #4427 as requested by @yuxiqian. -- 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]
