Skip to content

Commit

Permalink
Merge branch 'master' of github.com:metamx/druid into autoscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
Fangjin Yang committed Jan 15, 2013
2 parents ae76097 + 998f0bf commit 47ac36d
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ public Integer getNext()
}
}

public int getIncrement()
{
return increment;
}

public int[] getIncrements()
{
return increments;
Expand Down Expand Up @@ -301,11 +306,11 @@ public Row next()
return delegate.next();
}

if (cursor.isDone()) {
if (unprocessedKeys == null && cursor.isDone()) {
throw new NoSuchElementException();
}

final PositionMaintainer positionMaintainer = new PositionMaintainer(0, sizesRequired, metricsBuffer.limit());
final PositionMaintainer positionMaintainer = new PositionMaintainer(0, sizesRequired, metricsBuffer.remaining());
final RowUpdater rowUpdater = new RowUpdater(metricsBuffer, aggregators, positionMaintainer);
if (unprocessedKeys != null) {
for (ByteBuffer key : unprocessedKeys) {
Expand All @@ -327,6 +332,13 @@ public Row next()
cursor.advance();
}

if (rowUpdater.getPositions().isEmpty() && unprocessedKeys != null) {
throw new ISE(
"Not enough memory to process even a single item. Required [%,d] memory, but only have[%,d]",
positionMaintainer.getIncrement(), metricsBuffer.remaining()
);
}

delegate = FunctionalIterator
.create(rowUpdater.getPositions().entrySet().iterator())
.transform(
Expand Down

0 comments on commit 47ac36d

Please sign in to comment.