zhangshenghang opened a new pull request, #12696:
URL: https://github.com/apache/seatunnel/pull/12696
### Purpose of this pull request
`DefaultDataConverter#convert` has a null guard for a column that exists in
the planned `SeaTunnelRowType` but is missing from the live TiKV `TiTableInfo`:
```java
TiColumnInfo columnInfo = tableInfo.getColumn(fieldName);
if (columnInfo == null) {
fields[fieldIndex] = null;
}
DataType dataType = columnInfo.getType(); // NPE: dereferences the null
just checked
```
The guard branch sets a null field but is missing the `continue` that the
next branch (`value == null`) already has, so execution falls through and NPE-s
on `columnInfo.getType()` for **every** record whenever the guard is hit. The
two schemas are captured at different times (the row type from job planning,
the `TiTableInfo` fetched fresh from TiKV in `TiDBSourceReader#open`), so a
column dropped or renamed between planning and reading — a normal event for a
long-running CDC job — crashed the reader with a bare NPE instead of emitting a
null field.
This PR adds the missing `continue` so the converter emits a null field for
the missing column, consistent with the existing null-value branch.
### Does this PR introduce _any_ user-facing change?
No API/config change. Behaviour change: a TiDB-CDC job whose planned schema
contains a column that no longer exists in the live table info now emits `null`
for that column instead of crashing with an NPE.
### How was this patch tested?
Added `DefaultDataConverterTest` (unit tests): a row type with an extra
`dropped_col` that the live `TiTableInfo` does not contain now converts to a
row with `null` in that position (previously NPE), plus a schema-match sanity
case. Full module suite `connector-cdc-tidb` passes: 16 tests, 0 failures.
--
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]