@@ -159,14 +159,14 @@ private void handleDML(StructuredRecord source, StructuredRecord val, Offset rec
159159 return ;
160160 }
161161
162- DMLOperation op ;
162+ DMLOperation . Type op ;
163163 String opStr = val .get ("op" );
164164 if ("c" .equals (opStr )) {
165- op = DMLOperation .INSERT ;
165+ op = DMLOperation .Type . INSERT ;
166166 } else if ("u" .equals (opStr )) {
167- op = DMLOperation .UPDATE ;
167+ op = DMLOperation .Type . UPDATE ;
168168 } else if ("d" .equals (opStr )) {
169- op = DMLOperation .DELETE ;
169+ op = DMLOperation .Type . DELETE ;
170170 } else {
171171 LOG .warn ("Skipping unknown operation type '{}'" , opStr );
172172 return ;
@@ -199,17 +199,17 @@ private void handleDML(StructuredRecord source, StructuredRecord val, Offset rec
199199 Long ingestTime = val .get ("ts_ms" );
200200 DMLEvent .Builder builder = DMLEvent .builder ()
201201 .setOffset (recordOffset )
202- .setOperation (op )
202+ .setOperationType (op )
203203 .setDatabase (databaseName )
204204 .setTable (tableName )
205205 .setTransactionId (transactionId )
206206 .setIngestTimestamp (ingestTime )
207207 .setSnapshot (isSnapshot );
208208
209209 // It is required for the source to provide the previous row if the dml operation is 'UPDATE'
210- if (op == DMLOperation .UPDATE ) {
210+ if (op == DMLOperation .Type . UPDATE ) {
211211 emitter .emit (builder .setPreviousRow (before ).setRow (after ).build ());
212- } else if (op == DMLOperation .DELETE ) {
212+ } else if (op == DMLOperation .Type . DELETE ) {
213213 emitter .emit (builder .setRow (before ).build ());
214214 } else {
215215 emitter .emit (builder .setRow (after ).build ());
@@ -240,12 +240,12 @@ private void handleDDL(String ddlStatement, Offset recordOffset,
240240 TableId tableId = alteredEvent .tableId ();
241241 Table table = tables .forTable (tableId );
242242 SourceTable sourceTable = getSourceTable (database , tableId .table ());
243- DDLOperation ddlOp ;
243+ DDLOperation . Type ddlOp ;
244244 if (alteredEvent .previousTableId () != null ) {
245- ddlOp = DDLOperation .RENAME_TABLE ;
245+ ddlOp = DDLOperation .Type . RENAME_TABLE ;
246246 builder .setPrevTable (alteredEvent .previousTableId ().table ());
247247 } else {
248- ddlOp = DDLOperation .ALTER_TABLE ;
248+ ddlOp = DDLOperation .Type . ALTER_TABLE ;
249249 }
250250
251251 if (shouldEmitDdlEventForOperation (readAllTables , sourceTable , ddlOp )) {
@@ -260,8 +260,8 @@ private void handleDDL(String ddlStatement, Offset recordOffset,
260260 case DROP_TABLE :
261261 DdlParserListener .TableDroppedEvent droppedEvent = (DdlParserListener .TableDroppedEvent ) event ;
262262 sourceTable = getSourceTable (database , droppedEvent .tableId ().table ());
263- if (shouldEmitDdlEventForOperation (readAllTables , sourceTable , DDLOperation .DROP_TABLE )) {
264- ddlEvent = builder .setOperation (DDLOperation .DROP_TABLE )
263+ if (shouldEmitDdlEventForOperation (readAllTables , sourceTable , DDLOperation .Type . DROP_TABLE )) {
264+ ddlEvent = builder .setOperation (DDLOperation .Type . DROP_TABLE )
265265 .setTable (droppedEvent .tableId ().table ())
266266 .build ();
267267 }
@@ -271,8 +271,8 @@ private void handleDDL(String ddlStatement, Offset recordOffset,
271271 tableId = createdEvent .tableId ();
272272 table = tables .forTable (tableId );
273273 sourceTable = getSourceTable (database , tableId .table ());
274- if (shouldEmitDdlEventForOperation (readAllTables , sourceTable , DDLOperation .CREATE_TABLE )) {
275- ddlEvent = builder .setOperation (DDLOperation .CREATE_TABLE )
274+ if (shouldEmitDdlEventForOperation (readAllTables , sourceTable , DDLOperation .Type . CREATE_TABLE )) {
275+ ddlEvent = builder .setOperation (DDLOperation .Type . CREATE_TABLE )
276276 .setTable (tableId .table ())
277277 .setSchema (readAllTables ? Records .getSchema (table , mySqlValueConverters ) :
278278 Records .getSchema (table , mySqlValueConverters , sourceTable .getColumns ()))
@@ -281,24 +281,24 @@ private void handleDDL(String ddlStatement, Offset recordOffset,
281281 }
282282 break ;
283283 case DROP_DATABASE :
284- ddlEvent = builder .setOperation (DDLOperation .DROP_DATABASE ).build ();
284+ ddlEvent = builder .setOperation (DDLOperation .Type . DROP_DATABASE ).build ();
285285 break ;
286286 case CREATE_DATABASE :
287287 // due to a bug in io.debezium.relational.ddl.AbstractDdlParser#signalDropDatabase
288288 // a DROP_DATABASE event will be mistakenly categorized as a CREATE_DATABASE event.
289289 // TODO: check if this is fixed in a newer debezium version
290290 if (event .statement () != null && event .statement ().startsWith ("DROP DATABASE" )) {
291- ddlEvent = builder .setOperation (DDLOperation .DROP_DATABASE ).build ();
291+ ddlEvent = builder .setOperation (DDLOperation .Type . DROP_DATABASE ).build ();
292292 } else {
293- ddlEvent = builder .setOperation (DDLOperation .CREATE_DATABASE ).build ();
293+ ddlEvent = builder .setOperation (DDLOperation .Type . CREATE_DATABASE ).build ();
294294 }
295295 break ;
296296 case TRUNCATE_TABLE :
297297 DdlParserListener .TableTruncatedEvent truncatedEvent =
298298 (DdlParserListener .TableTruncatedEvent ) event ;
299299 sourceTable = getSourceTable (database , truncatedEvent .tableId ().table ());
300- if (shouldEmitDdlEventForOperation (readAllTables , sourceTable , DDLOperation .TRUNCATE_TABLE )) {
301- ddlEvent = builder .setOperation (DDLOperation .TRUNCATE_TABLE )
300+ if (shouldEmitDdlEventForOperation (readAllTables , sourceTable , DDLOperation .Type . TRUNCATE_TABLE )) {
301+ ddlEvent = builder .setOperation (DDLOperation .Type . TRUNCATE_TABLE )
302302 .setTable (truncatedEvent .tableId ().table ())
303303 .build ();
304304 }
@@ -318,12 +318,12 @@ private void handleDDL(String ddlStatement, Offset recordOffset,
318318 }
319319 }
320320
321- private boolean shouldEmitDdlEventForOperation (boolean readAllTables , SourceTable sourceTable , DDLOperation op ) {
321+ private boolean shouldEmitDdlEventForOperation (boolean readAllTables , SourceTable sourceTable , DDLOperation . Type op ) {
322322 return (!sourceTableNotValid (readAllTables , sourceTable )) &&
323323 (!isDDLOperationBlacklisted (readAllTables , sourceTable , op ));
324324 }
325325
326- private boolean isDDLOperationBlacklisted (boolean readAllTables , SourceTable sourceTable , DDLOperation op ) {
326+ private boolean isDDLOperationBlacklisted (boolean readAllTables , SourceTable sourceTable , DDLOperation . Type op ) {
327327 // return true if record consumer was not set to read all table events and the DDL op has been
328328 // blacklisted for this table
329329 return !readAllTables && sourceTable .getDdlBlacklist ().contains (op );
0 commit comments