Skip to content

Commit

Permalink
Fix StreamingBuffer to allow oldestEntryTime to be null (#1141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Aug 9, 2016
1 parent 8d76e73 commit 0637c80
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public static class StreamingBuffer implements Serializable {
private static final long serialVersionUID = 822027055549277843L;
private final long estimatedRows;
private final long estimatedBytes;
private final long oldestEntryTime;
private final Long oldestEntryTime;

StreamingBuffer(long estimatedRows, long estimatedBytes, long oldestEntryTime) {
StreamingBuffer(long estimatedRows, long estimatedBytes, Long oldestEntryTime) {
this.estimatedRows = estimatedRows;
this.estimatedBytes = estimatedBytes;
this.oldestEntryTime = oldestEntryTime;
Expand All @@ -77,9 +77,9 @@ public long estimatedBytes() {

/**
* Returns the timestamp of the oldest entry in the streaming buffer, in milliseconds since
* epoch.
* epoch. Returns {@code null} if the streaming buffer is empty.
*/
public long oldestEntryTime() {
public Long oldestEntryTime() {
return oldestEntryTime;
}

Expand Down Expand Up @@ -111,9 +111,13 @@ Streamingbuffer toPb() {
}

static StreamingBuffer fromPb(Streamingbuffer streamingBufferPb) {
Long oldestEntryTime = null;
if (streamingBufferPb.getOldestEntryTime() != null) {
oldestEntryTime = streamingBufferPb.getOldestEntryTime().longValue();
}
return new StreamingBuffer(streamingBufferPb.getEstimatedRows().longValue(),
streamingBufferPb.getEstimatedBytes().longValue(),
streamingBufferPb.getOldestEntryTime().longValue());
oldestEntryTime);
}
}

Expand Down

0 comments on commit 0637c80

Please sign in to comment.