Skip to content

Commit

Permalink
Remove stream usage from getPhysicalWrittenDataSize
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav8297 authored and sopel39 committed Aug 30, 2022
1 parent 95fd190 commit 31e1b1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,12 @@ public CounterStat getOutputPositions()

public long getPhysicalWrittenDataSize()
{
return operatorContexts.stream()
.mapToLong(OperatorContext::getPhysicalWrittenDataSize)
.sum();
// Avoid using stream api due to performance reasons
long physicalWrittenBytes = 0;
for (OperatorContext context : operatorContexts) {
physicalWrittenBytes += context.getPhysicalWrittenDataSize();
}
return physicalWrittenBytes;
}

public boolean isExecutionStarted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,12 @@ public CounterStat getOutputPositions()

public long getPhysicalWrittenDataSize()
{
return drivers.stream()
.mapToLong(DriverContext::getPhysicalWrittenDataSize)
.sum();
// Avoid using stream api due to performance reasons
long physicalWrittenBytes = 0;
for (DriverContext context : drivers) {
physicalWrittenBytes += context.getPhysicalWrittenDataSize();
}
return physicalWrittenBytes;
}

public PipelineStatus getPipelineStatus()
Expand Down

0 comments on commit 31e1b1a

Please sign in to comment.