private boolean internalHasNext() { if (firstTime) { firstTime = false; currentIterator.initialize(); } boolean hasNext = currentIterator.hasNext(); // If iterator is finished then check for next iterator. if (!hasNext) { currentIterator.close(); // Check next iterator is available in the list. if (counter < inputIterators.size()) { // Get the next iterator from the list. currentIterator = inputIterators.get(counter++); // Initialize the new iterator currentIterator.initialize(); hasNext = internalHasNext(); } } return hasNext; }
@Override public void close() { if (!closed) { super.close(); if (null != executorService) { executorService.shutdownNow(); } for (CarbonIterator inputIterator : inputIterators) { inputIterator.close(); } } }
@Override public boolean nextKeyValue() { return carbonIterator.hasNext(); }
@Override public void close() { if (!closed) { super.close(); for (CarbonIterator inputIterator : inputIterators) { inputIterator.close(); } } }
@Override public T getCurrentValue() throws IOException, InterruptedException { rowCount += 1; if (null != inputMetricsStats) { inputMetricsStats.incrementRecordRead(1L); } return readSupport.readRow(carbonIterator.next()); }
private boolean internalHasNext() { if (firstTime) { firstTime = false; currentIterator.initialize(); } boolean hasNext = currentIterator.hasNext(); // If iterator is finished then check for next iterator. if (!hasNext) { currentIterator.close(); // Check next iterator is available in the list. if (counter < inputIterators.size()) { // Get the next iterator from the list. currentIterator = inputIterators.get(counter++); // Initialize the new iterator currentIterator.initialize(); hasNext = internalHasNext(); } } return hasNext; }
@Override public void close() { if (!closed) { super.close(); for (CarbonIterator inputIterator : inputIterators) { inputIterator.close(); } } }
private CarbonRowBatch getBatch() { // Create batch and fill it. CarbonRowBatch carbonRowBatch = new CarbonRowBatch(batchSize); int count = 0; while (internalHasNext() && count < batchSize) { carbonRowBatch.addRow( new CarbonRow(convertToNoDictionaryToBytes(currentIterator.next(), dataFields))); count++; } rowCounter.getAndAdd(carbonRowBatch.getSize()); return carbonRowBatch; }
/** * Returns {@code true} if the iteration has more elements. (In other words, * returns {@code true} if {@link #next} would return an element rather than * throwing an exception.) * * @return {@code true} if the iteration has more elements */ @Override public boolean hasNext() { if (currentChunk != null && currentChunk.hasNext()) { return true; } else if (iterator != null && iterator.hasNext()) { currentChunk = iterator.next(); return hasNext(); } return false; }
queryIterator.close(); } catch (Throwable e) { exceptionOccurred = e;
private CarbonRowBatch getBatch() { // Create batch and fill it. CarbonRowBatch carbonRowBatch = new CarbonRowBatch(batchSize); int count = 0; if (isRawDataRequired) { while (internalHasNext() && count < batchSize) { Object[] rawRow = currentIterator.next(); carbonRowBatch.addRow(new CarbonRow(rowParser.parseRow(rawRow), rawRow)); count++; } } else { while (internalHasNext() && count < batchSize) { carbonRowBatch.addRow(new CarbonRow(rowParser.parseRow(currentIterator.next()))); count++; } } rowCounter.getAndAdd(carbonRowBatch.getSize()); return carbonRowBatch; } }
@Override public void close() throws IOException { logStatistics(rowCount, queryModel.getStatisticsRecorder()); // clear dictionary cache Map<String, Dictionary> columnToDictionaryMapping = queryModel.getColumnToDictionaryMapping(); if (null != columnToDictionaryMapping) { for (Map.Entry<String, Dictionary> entry : columnToDictionaryMapping.entrySet()) { CarbonUtil.clearDictionaryCache(entry.getValue()); } } if (!skipClearDataMapAtClose) { // Clear the datamap cache DataMapStoreManager.getInstance().clearDataMaps( queryModel.getTable().getAbsoluteTableIdentifier()); } // close read support readSupport.close(); carbonIterator.close(); try { queryExecutor.finish(); } catch (QueryExecutionException e) { throw new IOException(e); } }