diff --git a/core/trino-main/src/main/java/io/trino/event/QueryMonitor.java b/core/trino-main/src/main/java/io/trino/event/QueryMonitor.java index f91de65f52bd..bff4cd8f0aab 100644 --- a/core/trino-main/src/main/java/io/trino/event/QueryMonitor.java +++ b/core/trino-main/src/main/java/io/trino/event/QueryMonitor.java @@ -218,6 +218,7 @@ public void queryImmediateFailureEvent(BasicQueryInfo queryInfo, ExecutionFailur 0, 0, 0, + 0, ImmutableList.of(), 0, true, @@ -323,6 +324,7 @@ private QueryStatistics createQueryStatistics(QueryInfo queryInfo) queryStats.getOutputPositions(), queryStats.getLogicalWrittenDataSize().toBytes(), queryStats.getWrittenPositions(), + queryStats.getSpilledDataSize().toBytes(), queryStats.getCumulativeUserMemory(), queryStats.getFailedCumulativeUserMemory(), queryStats.getStageGcStatistics(), diff --git a/core/trino-spi/src/main/java/io/trino/spi/eventlistener/QueryStatistics.java b/core/trino-spi/src/main/java/io/trino/spi/eventlistener/QueryStatistics.java index 370cfc9b6018..e90b7f379a5e 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/eventlistener/QueryStatistics.java +++ b/core/trino-spi/src/main/java/io/trino/spi/eventlistener/QueryStatistics.java @@ -59,6 +59,7 @@ public class QueryStatistics private final long outputRows; private final long writtenBytes; private final long writtenRows; + private final long spilledBytes; private final double cumulativeMemory; private final double failedCumulativeMemory; @@ -115,6 +116,7 @@ public QueryStatistics( long outputRows, long writtenBytes, long writtenRows, + long spilledBytes, double cumulativeMemory, double failedCumulativeMemory, List stageGcStatistics, @@ -155,6 +157,7 @@ public QueryStatistics( this.outputRows = outputRows; this.writtenBytes = writtenBytes; this.writtenRows = writtenRows; + this.spilledBytes = spilledBytes; this.cumulativeMemory = cumulativeMemory; this.failedCumulativeMemory = failedCumulativeMemory; this.stageGcStatistics = requireNonNull(stageGcStatistics, "stageGcStatistics is null"); @@ -346,6 +349,12 @@ public long getWrittenRows() return writtenRows; } + @JsonProperty + public long getSpilledBytes() + { + return spilledBytes; + } + @JsonProperty public double getCumulativeMemory() { diff --git a/plugin/trino-http-event-listener/src/test/java/io/trino/plugin/httpquery/TestHttpEventListener.java b/plugin/trino-http-event-listener/src/test/java/io/trino/plugin/httpquery/TestHttpEventListener.java index 91580844ce61..51e6f57f16ed 100644 --- a/plugin/trino-http-event-listener/src/test/java/io/trino/plugin/httpquery/TestHttpEventListener.java +++ b/plugin/trino-http-event-listener/src/test/java/io/trino/plugin/httpquery/TestHttpEventListener.java @@ -179,6 +179,7 @@ public class TestHttpEventListener 0L, 0L, 0L, + 0L, 0.0f, Collections.emptyList(), 0, diff --git a/plugin/trino-mysql-event-listener/src/test/java/io/trino/plugin/eventlistener/mysql/TestMysqlEventListener.java b/plugin/trino-mysql-event-listener/src/test/java/io/trino/plugin/eventlistener/mysql/TestMysqlEventListener.java index c49c9377b431..0825351bcfbc 100644 --- a/plugin/trino-mysql-event-listener/src/test/java/io/trino/plugin/eventlistener/mysql/TestMysqlEventListener.java +++ b/plugin/trino-mysql-event-listener/src/test/java/io/trino/plugin/eventlistener/mysql/TestMysqlEventListener.java @@ -110,6 +110,7 @@ public class TestMysqlEventListener 125L, 126L, 127L, + 1271L, 128.0, 129.0, // not stored @@ -257,6 +258,7 @@ public class TestMysqlEventListener 125L, 126L, 127L, + 1271L, 128.0, 129.0, // not stored diff --git a/testing/trino-tests/src/test/java/io/trino/execution/TestEventListenerBasic.java b/testing/trino-tests/src/test/java/io/trino/execution/TestEventListenerBasic.java index 2bc0a4a77a13..886e49d9ec53 100644 --- a/testing/trino-tests/src/test/java/io/trino/execution/TestEventListenerBasic.java +++ b/testing/trino-tests/src/test/java/io/trino/execution/TestEventListenerBasic.java @@ -729,6 +729,7 @@ public void testOutputStats() assertEquals(statistics.getOutputRows(), queryStats.getOutputPositions()); assertEquals(statistics.getWrittenBytes(), queryStats.getLogicalWrittenDataSize().toBytes()); assertEquals(statistics.getWrittenRows(), queryStats.getWrittenPositions()); + assertEquals(statistics.getSpilledBytes(), queryStats.getSpilledDataSize().toBytes()); assertEquals(statistics.getCumulativeMemory(), queryStats.getCumulativeUserMemory()); assertEquals(statistics.getStageGcStatistics(), queryStats.getStageGcStatistics()); assertEquals(statistics.getCompletedSplits(), queryStats.getCompletedDrivers());