dangzitou opened a new pull request, #4427:
URL: https://github.com/apache/flink-cdc/pull/4427

   ## What this PR does
   
   This PR fixes two minor but important issues:
   
   ### 1. Platform-default charset in `SchemaMergingUtils.coerceToBytes()`
   
   **File:** `flink-cdc-common/.../SchemaMergingUtils.java:617`
   
   `originalField.toString().getBytes()` uses the platform-default charset, 
which can vary across JVM configurations and operating systems. This causes 
inconsistent behavior when converting fields to bytes during schema evolution.
   
   **Fix:** Use `StandardCharsets.UTF_8` explicitly.
   
   ### 2. Unchecked `Optional.get()` in Kafka serialization schemas
   
   **Files:**
   - `CsvSerializationSchema.java:109`
   - `JsonSerializationSchema.java:132`
   
   Both files call `schema.getColumn(...).get()` without checking if the 
Optional is present. If a primary key column is missing from the schema (e.g., 
after schema evolution), this throws a bare `NoSuchElementException` with no 
context.
   
   **Fix:** Replace with `orElseThrow()` that includes the missing column name 
in the error message.
   
   ## Testing
   
   These are straightforward defensive improvements:
   - The charset fix ensures consistent UTF-8 encoding regardless of JVM locale
   - The Optional guard improves error diagnostics without changing happy-path 
behavior


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