Source:
public List<SinkRecord> add(SinkRecord record) throws SQLException { final List<SinkRecord> flushed = new ArrayList<>(); boolean schemaChanged = false; if (!Objects.equals(keySchema, record.keySchema())) { keySchema = record.keySchema(); schemaChanged = true; } if (isNull(record.valueSchema())) { if (config.deleteEnabled) { deletesInBatch = true; } } else if (Objects.equals(valueSchema, record.valueSchema())) { if (config.deleteEnabled && deletesInBatch) { flushed.addAll(flush()); } } else { valueSchema = record.valueSchema(); schemaChanged = true; } if (schemaChanged) { flushed.addAll(flush()); final SchemaPair schemaPair = new SchemaPair( record.keySchema(), record.valueSchema() ); fieldsMetadata = FieldsMetadata.extract( tableId.tableName(), config.pkMode, config.pkFields, config.fieldsWhitelist, schemaPair ); dbStructure.createOrAmendIfNecessary( config, connection, tableId, fieldsMetadata ); final String insertSql = getInsertSql(); final String deleteSql = getDeleteSql(); log.debug( "{} sql: deleteSql: meta: {}", config.insertMode, insertSql, deleteSql, fieldsMetadata ); close(); updatePreparedStatement = connection.prepareStatement(insertSql); updateStatementBinder = dbDialect.statementBinder( updatePreparedStatement, config.pkMode, schemaPair, fieldsMetadata, config.insertMode ); if (config.deleteEnabled && nonNull(deleteSql)) { deletePreparedStatement = connection.prepareStatement(deleteSql); deleteStatementBinder = dbDialect.statementBinder( deletePreparedStatement, config.pkMode, schemaPair, fieldsMetadata, config.insertMode ); } } records.add(record); if (records.size() >= config.batchSize) { flushed.addAll(flush()); } return flushed; }

Target:
public List<SinkRecord> add(SinkRecord record) throws SQLException { final List<SinkRecord> flushed = new ArrayList<>(); boolean schemaChanged = false; if (!Objects.equals(keySchema, record.keySchema())) { keySchema = record.keySchema(); schemaChanged = true; } if (isNull(record.valueSchema())) { if (config.deleteEnabled) { deletesInBatch = true; } } else if (Objects.equals(valueSchema, record.valueSchema())) { if (config.deleteEnabled && deletesInBatch) { flushed.addAll(flush()); } } else { valueSchema = record.valueSchema(); schemaChanged = true; } if (schemaChanged) { flushed.addAll(flush()); final SchemaPair schemaPair = new SchemaPair( record.keySchema(), record.valueSchema() ); fieldsMetadata = FieldsMetadata.extract( tableId.tableName(), config.pkMode, config.pkFields, config.fieldsWhitelist, schemaPair ); dbStructure.createOrAmendIfNecessary( config, connection, tableId, fieldsMetadata ); final String insertSql = getInsertSql(); final String deleteSql = getDeleteSql(); log.debug( "{} sql: deleteSql: meta: {}", config.insertMode, insertSql, deleteSql, fieldsMetadata ); close(); updatePreparedStatement = dbDialect.createPreparedStatement(connection, insertSql); updateStatementBinder = dbDialect.statementBinder( updatePreparedStatement, config.pkMode, schemaPair, fieldsMetadata, config.insertMode ); if (config.deleteEnabled && nonNull(deleteSql)) { deletePreparedStatement = dbDialect.createPreparedStatement(connection, deleteSql); deleteStatementBinder = dbDialect.statementBinder( deletePreparedStatement, config.pkMode, schemaPair, fieldsMetadata, config.insertMode ); } } records.add(record); if (records.size() >= config.batchSize) { flushed.addAll(flush()); } return flushed; }