@Override public Progress getProgress() { if (currentIteratorIndex < 0) { // Reading has not been started yet. return null; } ConcatPosition concatPosition = new ConcatPosition(); concatPosition.setIndex(currentIteratorIndex); Progress progressOfCurrentIterator = currentIterator.getProgress(); if (!(progressOfCurrentIterator instanceof DataflowReaderProgress)) { throw new IllegalArgumentException( "Cannot process progress " + progressOfCurrentIterator + " since ConcatReader can only handle readers that generate a progress of type " + "DataflowReaderProgress"); } com.google.api.services.dataflow.model.Position positionOfCurrentIterator = ((DataflowReaderProgress) progressOfCurrentIterator).cloudProgress.getPosition(); if (positionOfCurrentIterator != null) { concatPosition.setPosition(positionOfCurrentIterator); } ApproximateReportedProgress progress = new ApproximateReportedProgress(); com.google.api.services.dataflow.model.Position currentPosition = new com.google.api.services.dataflow.model.Position(); currentPosition.setConcatPosition(concatPosition); progress.setPosition(currentPosition); return cloudProgressToReaderProgress(progress); }
@Override public Progress getProgress() { // Currently we assume that only a record index position is reported as // current progress. An implementer can override this method to update // other metrics, e.g. completion percentage or remaining time. com.google.api.services.dataflow.model.Position currentPosition = new com.google.api.services.dataflow.model.Position(); currentPosition.setRecordIndex((long) nextIndex); ApproximateReportedProgress progress = new ApproximateReportedProgress(); progress.setPosition(currentPosition); return cloudProgressToReaderProgress(progress); }