DBZ-2166 Handling error condition where schema field can not be found in

TableSchemaBuilder
This commit is contained in:
Fabian Aussems 2020-05-28 12:25:00 +03:00 committed by Gunnar Morling
parent d85729350b
commit 283740f37e

View File

@ -313,20 +313,28 @@ protected Field[] fieldsForColumns(Schema schema, List<Column> columns) {
* @return the converters for each column in the rows; never null
*/
protected ValueConverter[] convertersForColumns(Schema schema, TableId tableId, List<Column> columns, ColumnMappers mappers) {
ValueConverter[] converters = new ValueConverter[columns.size()];
for (int i = 0; i < columns.size(); i++) {
Column column = columns.get(i);
ValueConverter converter = null;
Field field = schema.field(column.name());
ValueConverter converter = createValueConverterFor(tableId, column, schema.field(column.name()));
converter = wrapInMappingConverterIfNeeded(mappers, tableId, column, converter);
if (converter == null) {
if (field == null) {
LOGGER.warn(
"No converter found for column {}.{} of type {}. The column will not be part of change events for that table.",
"No schema field found for column {}.{} of type {}. The column will not be part of change events for that table.",
tableId, column.name(), column.typeName());
}
else {
converter = createValueConverterFor(tableId, column, field);
converter = wrapInMappingConverterIfNeeded(mappers, tableId, column, converter);
if (converter == null) {
LOGGER.warn(
"No converter found for column {}.{} of type {}. The column will not be part of change events for that table.",
tableId, column.name(), column.typeName());
}
}
// may be null if no converter found
converters[i] = converter;