jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcMySqlBinLogRecordReader.java
@Override
  String getFieldPath(String columnName, Map<String, String> columnsToField, int op) {
    if (op == OperationType.DELETE_CODE){
      String fieldPath = columnsToField.get(columnName);
      if (fieldPath == null){
        LOG.error("Column name {} is not defined in column-filed mapping", columnName);
        return null;
      }
      return fieldPath.replace("/Data", "/OldData");
    }
    // For insert and update, ok to use the field name set by column-field mapping
    return columnsToField.get(columnName);
  }
@Override
  String getFieldPath(String columnName, Map<String, String> columnsToField, int op) {
    if (op == OperationType.DELETE_CODE){
      String fieldPath = columnsToField.get(columnName);
      if (fieldPath == null){
        LOG.error("Column name {} is not defined in column-filed mapping", columnName);
        return null;
      }
      return fieldPath.replace("/Data", "/OldData");
    }
    // For insert and update, ok to use the field name set by column-field mapping
    return columnsToField.get(columnName);
  }
@ Override String getFieldPath ( String columnName , Map < String , String > columnsToField , int op ) { if ( op == OperationType . DELETE_CODE ) { String fieldPath = columnsToField . get ( columnName ) ; if ( fieldPath == null ) { LOG . error ( "Column name {} is not defined in column-filed mapping" , columnName ) ; return null ; } return fieldPath . replace ( "/Data" , "/OldData" ) ; } // For insert and update, ok to use the field name set by column-field mapping return columnsToField . get ( columnName ) ; }
Return a fieldpath for the corresponding column name. The columnToField Map
contains column-to-field mapping, so simply get fieldpath for the column name
if operation is INSERT or UPDATE.
We replace /Data to /OldData for delete operation because that's where records
store primary key info.
@param columnName column name
@param columnsToField mapping of column name to field path
@param op  Not used here but is used in subclass.
@return
Return a fieldpath for the corresponding column name . The columnToField Map contains column - to - field mapping so simply get fieldpath for the column name if operation is INSERT or UPDATE . We replace / Data to / OldData for delete operation because that s where records store primary key info .