Skip to content

Commit

Permalink
DBZ-4272 Throw exception for non matching schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jpechane authored and gunnarmorling committed Nov 30, 2021
1 parent 5e40e1c commit 2789dd6
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions debezium-core/src/main/java/io/debezium/util/ColumnUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.debezium.relational.Column;
import io.debezium.relational.Table;

Expand All @@ -22,8 +19,6 @@
*/
public class ColumnUtils {

private static final Logger LOGGER = LoggerFactory.getLogger(ColumnUtils.class);

public static MappedColumns toMap(Table table) {
Map<String, Column> sourceTableColumns = new HashMap<>();
int greatestColumnPosition = 0;
Expand Down Expand Up @@ -54,14 +49,15 @@ public static ColumnArray toArray(ResultSet resultSet, Table table) throws SQLEx
for (int j = 0; j < metaData.getColumnCount(); j++) {
resultSetColumns[j] = metaData.getColumnName(j + 1);
}
LOGGER.warn(
"Column '{}' not found in result set '{}' for table '{}', {}. This might be caused by DBZ-4350",
columnName,
String.join(", ", resultSetColumns),
table.id(),
table,
new IllegalArgumentException("Columns in schema do not match result set"));
continue;
throw new IllegalArgumentException("Column '"
+ columnName
+ "' not found in result set '"
+ String.join(", ", resultSetColumns)
+ "' for table '"
+ table.id()
+ "', "
+ table
+ ". This might be caused by DBZ-4350");
}
greatestColumnPosition = greatestColumnPosition < columns[i].position()
? columns[i].position()
Expand Down

0 comments on commit 2789dd6

Please sign in to comment.