Skip to content

Commit

Permalink
Add physicalWrittenBytes to StatementStats
Browse files Browse the repository at this point in the history
  • Loading branch information
jkylling authored and raunaqmorarka committed Aug 15, 2023
1 parent efc2ad9 commit f2278e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class StatementStats
private final long processedRows;
private final long processedBytes;
private final long physicalInputBytes;
private final long physicalWrittenBytes;
private final long peakMemoryBytes;
private final long spilledBytes;
private final StageStats rootStage;
Expand All @@ -66,6 +67,7 @@ public StatementStats(
@JsonProperty("processedRows") long processedRows,
@JsonProperty("processedBytes") long processedBytes,
@JsonProperty("physicalInputBytes") long physicalInputBytes,
@JsonProperty("physicalWrittenBytes") long physicalWrittenBytes,
@JsonProperty("peakMemoryBytes") long peakMemoryBytes,
@JsonProperty("spilledBytes") long spilledBytes,
@JsonProperty("rootStage") StageStats rootStage)
Expand All @@ -87,6 +89,7 @@ public StatementStats(
this.processedRows = processedRows;
this.processedBytes = processedBytes;
this.physicalInputBytes = physicalInputBytes;
this.physicalWrittenBytes = physicalWrittenBytes;
this.peakMemoryBytes = peakMemoryBytes;
this.spilledBytes = spilledBytes;
this.rootStage = rootStage;
Expand Down Expand Up @@ -194,6 +197,12 @@ public long getPhysicalInputBytes()
return physicalInputBytes;
}

@JsonProperty
public long getPhysicalWrittenBytes()
{
return physicalWrittenBytes;
}

@JsonProperty
public long getPeakMemoryBytes()
{
Expand Down Expand Up @@ -234,6 +243,7 @@ public String toString()
.add("processedRows", processedRows)
.add("processedBytes", processedBytes)
.add("physicalInputBytes", physicalInputBytes)
.add("physicalWrittenBytes", physicalWrittenBytes)
.add("peakMemoryBytes", peakMemoryBytes)
.add("spilledBytes", spilledBytes)
.add("rootStage", rootStage)
Expand Down Expand Up @@ -264,6 +274,7 @@ public static class Builder
private long processedRows;
private long processedBytes;
private long physicalInputBytes;
private long physicalWrittenBytes;
private long peakMemoryBytes;
private long spilledBytes;
private StageStats rootStage;
Expand Down Expand Up @@ -372,6 +383,12 @@ public Builder setPhysicalInputBytes(long physicalInputBytes)
return this;
}

public Builder setPhysicalWrittenBytes(long physicalWrittenBytes)
{
this.physicalWrittenBytes = physicalWrittenBytes;
return this;
}

public Builder setPeakMemoryBytes(long peakMemoryBytes)
{
this.peakMemoryBytes = peakMemoryBytes;
Expand Down Expand Up @@ -410,6 +427,7 @@ public StatementStats build()
processedRows,
processedBytes,
physicalInputBytes,
physicalWrittenBytes,
peakMemoryBytes,
spilledBytes,
rootStage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private String newQueryResults(Integer partialCancelId, Integer nextUriId, List<
nextUriId == null ? null : server.url(format("/v1/statement/%s/%s", queryId, nextUriId)).uri(),
responseColumns,
data,
new StatementStats(state, state.equals("QUEUED"), true, OptionalDouble.of(0), OptionalDouble.of(0), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null),
new StatementStats(state, state.equals("QUEUED"), true, OptionalDouble.of(0), OptionalDouble.of(0), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null),
null,
ImmutableList.of(),
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public static StatementStats toStatementStats(QueryInfo queryInfo)
.setProcessedRows(queryStats.getRawInputPositions())
.setProcessedBytes(queryStats.getRawInputDataSize().toBytes())
.setPhysicalInputBytes(queryStats.getPhysicalInputDataSize().toBytes())
.setPhysicalWrittenBytes(queryStats.getPhysicalWrittenDataSize().toBytes())
.setPeakMemoryBytes(queryStats.getPeakUserMemoryReservation().toBytes())
.setSpilledBytes(queryStats.getSpilledDataSize().toBytes())
.setRootStage(rootStageStats)
Expand Down

0 comments on commit f2278e7

Please sign in to comment.