You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "lucasgameiroborges (via GitHub)" <gi...@apache.org> on 2026/09/14 13:02:16 UTC

[I] Flink: DynamicIcebergSink writes CDC delete records as inserts when the record needs schema conversion [iceberg]

lucasgameiroborges opened a new issue, #18100:
URL: https://github.com/apache/iceberg/issues/18100

   ### Apache Iceberg version
   
   1.10.0
   
   ### Query engine
   
   Flink
   
   ### Please describe the bug 🐞
   
   **Component: Flink / DynamicIcebergSink**
   
   **Versions:**
     - Apache Iceberg: 1.10.0 (iceberg-flink-runtime-2.0), also present on `main` (v2.1/v2.2/v2.3 flink modules carry the same line)
     - Apache Flink: 2.0
   
   **Description:**
   
   The Flink `DynamicIcebergSink` rebuilds a record whenever the incoming row's schema is not byte-identical to the target table's schema (column-order different, missing optional column, widening type) and that rebuild happens in `DataConverter.RowDataConverter.convert()`: [LINK](https://github.com/apache/iceberg/blob/main/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DataConverter.java#L172)
   
   ```java
   GenericRowData targetData = new GenericRowData(fieldGetters.length);
   ```
   
   `GenericRowData(int)` defaults RowKind to `INSERT` instead of propagating the proper kind. Nothing else ever calls `setRowKind()` on the result, so any converted row comes out as `INSERT` regardless of the source row's actual kind (`UPDATE_BEFORE`, `UPDATE_AFTER`, `DELETE`).
   
   `BaseDeltaTaskWriter` (the Flink CDC delta writer) dispatches purely on `RowKind`. So a CDC delete/tombstone that happens to go through this "needs conversion" path (e.g. it doesn't yet carry every optional column the table now has, or its columns are ordered differently) is silently treated as an insert.
   
   **Root cause:**
   
   `RowKind` is dropped when `RowDataConverter` allocates the replacement `GenericRowData`.
   
   **Fix:**
   
   Carry the source row's kind onto the converted row:
   
   ```java
   GenericRowData targetData = new GenericRowData(sourceData.getRowKind(), fieldGetters.length);
   ```
   
   ### Willingness to contribute
   
   - [x] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


-- 
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: issues-unsubscribe@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Flink: DynamicIcebergSink writes CDC delete records as inserts when the record needs schema conversion [iceberg]

Posted by "pvary (via GitHub)" <gi...@apache.org>.
pvary closed issue #18100: Flink: DynamicIcebergSink writes CDC delete records as inserts when the record needs schema conversion
URL: https://github.com/apache/iceberg/issues/18100


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Flink: DynamicIcebergSink writes CDC delete records as inserts when the record needs schema conversion [iceberg]

Posted by "zhang-arvin (via GitHub)" <gi...@apache.org>.
zhang-arvin commented on issue #18100:
URL: https://github.com/apache/iceberg/issues/18100#issuecomment-5666883189

   I will work on this.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org