Skip to content

Commit

Permalink
Opportunistically reuse instance in OperatorStats#summarize()
Browse files Browse the repository at this point in the history
  • Loading branch information
pettyjamesm authored and martint committed Nov 12, 2021
1 parent 387c444 commit c9c711e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public class OperatorStats

private final Optional<BlockedReason> blockedReason;

@Nullable
private final OperatorInfo info;

@JsonCreator
Expand Down Expand Up @@ -140,6 +141,7 @@ public OperatorStats(

@JsonProperty("blockedReason") Optional<BlockedReason> blockedReason,

@Nullable
@JsonProperty("info") OperatorInfo info)
{
this.stageId = stageId;
Expand Down Expand Up @@ -623,6 +625,10 @@ private static <T> Mergeable<T> mergeInfo(Mergeable<T> base, T other)

public OperatorStats summarize()
{
if (info == null || info.isFinal()) {
return this;
}
OperatorInfo info = null;
return new OperatorStats(
stageId,
pipelineId,
Expand Down Expand Up @@ -663,6 +669,6 @@ public OperatorStats summarize()
peakTotalMemoryReservation,
spilledDataSize,
blockedReason,
(info != null && info.isFinal()) ? info : null);
info);
}
}

0 comments on commit c9c711e

Please sign in to comment.