Github user jackylk commented on a diff in the pull request: https://github.com/apache/incubator-carbondata/pull/333#discussion_r90588455 --- Diff: processing/src/main/java/org/apache/carbondata/processing/newflow/steps/InputProcessorStepImpl.java --- @@ -122,24 +139,52 @@ private boolean internalHasNext() { if (!hasNext) { // Check next iterator is available in the list. if (counter < inputIterators.size()) { + // close the old iterator + currentIterator.close(); // Get the next iterator from the list. currentIterator = inputIterators.get(counter++); + // Initialize the new iterator + currentIterator.initialize(); hasNext = internalHasNext(); } } return hasNext; } - @Override - public CarbonRowBatch next() { - // Create batch and fill it. - CarbonRowBatch carbonRowBatch = new CarbonRowBatch(); - int count = 0; - while (internalHasNext() && count < batchSize) { - carbonRowBatch.addRow(new CarbonRow(rowParser.parseRow(currentIterator.next()))); - count++; + @Override public CarbonRowBatch next() { + CarbonRowBatch result = null; + try { + if (future == null) { + future = getCarbonRowBatch(); + } + result = future.get(); + nextBatch = false; + if (hasNext()) { + nextBatch = true; + future = getCarbonRowBatch(); + } else { + currentIterator.close(); + } + } catch (Exception e) { --- End diff -- cache InterruptedException, ExecutionException only
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---