Source:
public TaskReport ingestServiceData(final T task, RecordImporter recordImporter, int taskIndex, PageBuilder pageBuilder) { TaskReport taskReport = Exec.newTaskReport(); if (Exec.isPreview()) { return importMockPreviewData(pageBuilder); } else { try (LineDecoderIterator decoderIterator = getLineDecoderIterator(task)) { Iterator<Map<String, String>> csvRecords = Iterators.concat(Iterators.transform(decoderIterator, new Function<LineDecoder, Iterator<Map<String, String>>>() { @Override public Iterator<Map<String, String>> apply(LineDecoder input) { return new CsvRecordIterator(input, task); } })); long currentTimestamp = 0L; Set<String> latestUids = task.getPreviousUids(); if (Exec.isPreview()) { csvRecords = Iterators.limit(csvRecords, PREVIEW_RECORD_LIMIT); } while (csvRecords.hasNext()) { Map<String, String> csvRecord = csvRecords.next(); if (task.getIncremental()) { if (!csvRecord.containsKey(incrementalColumn)) { throw new DataException("Extracted record doesn't have incremental column " + incrementalColumn); } if (uidColumn != null) { String uid = csvRecord.get(uidColumn); if (latestUids.contains(uid)) { continue; } } String incrementalTimeStamp = csvRecord.get(incrementalColumn); long timestamp = ISO_DATETIME_FORMAT.parseDateTime(incrementalTimeStamp).getMillis(); if (currentTimestamp < timestamp) { currentTimestamp = timestamp; latestUids.clear(); } else if (currentTimestamp == timestamp) { if (uidColumn != null) { String uuid = csvRecord.get(uidColumn); latestUids.add(uuid); } } } ObjectNode objectNode = MarketoUtils.OBJECT_MAPPER.valueToTree(csvRecord); recordImporter.importRecord(new AllStringJacksonServiceRecord(objectNode), pageBuilder); } taskReport.set(LATEST_FETCH_TIME, currentTimestamp); taskReport.set(LATEST_UID_LIST, latestUids); return taskReport; } } }

Target:
public TaskReport ingestServiceData(final T task, RecordImporter recordImporter, int taskIndex, PageBuilder pageBuilder) { TaskReport taskReport = Exec.newTaskReport(); String incrementalColumn = task.getIncrementalColumn().orNull(); String uidColumn = task.getUidColumn().orNull(); if (Exec.isPreview()) { return importMockPreviewData(pageBuilder); } else { try (LineDecoderIterator decoderIterator = getLineDecoderIterator(task)) { Iterator<Map<String, String>> csvRecords = Iterators.concat(Iterators.transform(decoderIterator, new Function<LineDecoder, Iterator<Map<String, String>>>() { @Override public Iterator<Map<String, String>> apply(LineDecoder input) { return new CsvRecordIterator(input, task); } })); long currentTimestamp = 0L; Set<String> latestUids = task.getPreviousUids(); if (Exec.isPreview()) { csvRecords = Iterators.limit(csvRecords, PREVIEW_RECORD_LIMIT); } while (csvRecords.hasNext()) { Map<String, String> csvRecord = csvRecords.next(); if (task.getIncremental()) { if (!csvRecord.containsKey(incrementalColumn)) { throw new DataException("Extracted record doesn't have incremental column " + incrementalColumn); } if (uidColumn != null) { String uid = csvRecord.get(uidColumn); if (latestUids.contains(uid)) { continue; } } String incrementalTimeStamp = csvRecord.get(incrementalColumn); long timestamp = ISO_DATETIME_FORMAT.parseDateTime(incrementalTimeStamp).getMillis(); if (currentTimestamp < timestamp) { currentTimestamp = timestamp; latestUids.clear(); } else if (currentTimestamp == timestamp) { if (uidColumn != null) { String uid = csvRecord.get(uidColumn); latestUids.add(uid); } } } ObjectNode objectNode = MarketoUtils.OBJECT_MAPPER.valueToTree(csvRecord); recordImporter.importRecord(new AllStringJacksonServiceRecord(objectNode), pageBuilder); } taskReport.set(LATEST_FETCH_TIME, currentTimestamp); taskReport.set(LATEST_UID_LIST, latestUids); return taskReport; } } }