jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcRecordReader.java
@VisibleForTesting
  SortedMap<String, String> getColumnsToParameters(
      final Record record,
      int op,
      Map<String, String> parameters,
      Map<String, String> columnsToFields
  ) {
    SortedMap<String, String> filtered = new TreeMap<>();
    for (Map.Entry<String, String> entry : columnsToFields.entrySet()) {
      String columnName = entry.getKey();
      String fieldPath = entry.getValue();

      if (record.has(fieldPath)) {
        filtered.put(columnName, parameters.get(columnName));
      } else {
        LOG.trace("Record is missing a field for column {} for the operation code {}", columnName, op);
      }
    }
    return filtered;
  }
@VisibleForTesting
  SortedMap<String, String> getColumnsToParameters(
      final Record record,
      int op,
      Map<String, String> parameters,
      Map<String, String> columnsToFields
  ) {
    SortedMap<String, String> filtered = new TreeMap<>();
    for (Map.Entry<String, String> entry : columnsToFields.entrySet()) {
      String columnName = entry.getKey();
      String fieldPath = entry.getValue();

      if (record.has(fieldPath)) {
        filtered.put(columnName, parameters.get(columnName));
      } else {
        LOG.trace("Record is missing a field for column {} for the operation code {}", columnName, op);
      }
    }
    return filtered;
  }
@ VisibleForTesting SortedMap < String , String > getColumnsToParameters ( final Record record , int op , Map < String , String > parameters , Map < String , String > columnsToFields ) { SortedMap < String , String > filtered = new TreeMap <> ( ) ; for ( Map . Entry < String , String > entry : columnsToFields . entrySet ( ) ) { String columnName = entry . getKey ( ) ; String fieldPath = entry . getValue ( ) ; if ( record . has ( fieldPath ) ) { filtered . put ( columnName , parameters . get ( columnName ) ) ; } else { LOG . trace ( "Record is missing a field for column {} for the operation code {}" , columnName , op ) ; } } return filtered ; }
Iterate the columnsToField map and check if the record has all the necessary columns.
The returned SortedMap contains columnName-param mapping which is only contained in this record.
For example, if a table in destination DB has a column A but record doesn't have a field named A,
the column A is not included in the returning SortedMap.
@param record Record to check
@param op Operation code. Used mainly in subclass
@param parameters columnName-to-value mapping
@param columnsToFields columnName-to-fieldPath mapping
@return
Iterate the columnsToField map and check if the record has all the necessary columns . The returned SortedMap contains columnName - param mapping which is only contained in this record . For example if a table in destination DB has a column A but record doesn t have a field named A the column A is not included in the returning SortedMap .