lucasgameiroborges opened a new pull request, #18196:
URL: https://github.com/apache/iceberg/pull/18196

   ## What
   
   Backports #18101 (merged to `flink/v2.3`) to the other currently-supported 
Flink versions: `flink/v1.20`, `flink/v2.1`, `flink/v2.2`.
   
   Same one-line fix in each version's 
`DataConverter.RowDataConverter.convert()`:
   
   ```java
   -      GenericRowData targetData = new GenericRowData(fieldGetters.length);
   +      GenericRowData targetData = new 
GenericRowData(sourceData.getRowKind(), fieldGetters.length);
   ```
   
   Plus the same `testPreservesRowKind` regression test in each version's 
`TestRowDataConverter`.
   
   ## Why
   
   See #18100 / #18101 for the full writeup. Summary: 
`RowDataConverter.convert()` rebuilds a row whenever its schema doesn't 
byte-match the target table's, via `new GenericRowData(fieldGetters.length)`, 
which defaults to `RowKind.INSERT` and drops the original kind. 
`BaseDeltaTaskWriter` dispatches on `RowKind`, so a converted CDC 
delete/`UPDATE_BEFORE` reaches it as an `INSERT` — written as data (or NPEs if 
a required non-key column is missing), instead of deleted.
   
   `flink/v1.20`, `flink/v2.1`, and `flink/v2.2` were byte-identical to 
`flink/v2.3` pre-fix in both `DataConverter.java` and 
`TestRowDataConverter.java`, so the same patch applies unchanged to all three.
   
   ## Testing
   
   - `TestRowDataConverter#testPreservesRowKind` passes on all three 
(`iceberg-flink-1.20`, `iceberg-flink-2.1`, `iceberg-flink-2.2`) with the fix, 
and fails without it (spot-checked on 2.1: `expected: DELETE but was: INSERT`)
   - `spotlessCheck` clean on all three modules
   
   Requested by @pvary in 
https://github.com/apache/iceberg/pull/18101#issuecomment-5665890557.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to