diff --git a/core/trino-main/src/main/java/io/trino/execution/QueryManagerStats.java b/core/trino-main/src/main/java/io/trino/execution/QueryManagerStats.java index 61833c267531..3537b142c485 100644 --- a/core/trino-main/src/main/java/io/trino/execution/QueryManagerStats.java +++ b/core/trino-main/src/main/java/io/trino/execution/QueryManagerStats.java @@ -50,6 +50,9 @@ public class QueryManagerStats private final CounterStat consumedCpuTimeSecs = new CounterStat(); private final TimeStat executionTime = new TimeStat(MILLISECONDS); private final TimeStat queuedTime = new TimeStat(MILLISECONDS); + private final TimeStat elapsedTime = new TimeStat(MILLISECONDS); + private final TimeStat analysisTime = new TimeStat(MILLISECONDS); + private final TimeStat planningTime = new TimeStat(MILLISECONDS); private final DistributionStat wallInputBytesRate = new DistributionStat(); private final DistributionStat cpuInputByteRate = new DistributionStat(); @@ -82,6 +85,9 @@ private void queryFinished(BasicQueryInfo info) consumedInputRows.update(info.getQueryStats().getRawInputPositions()); executionTime.add(info.getQueryStats().getExecutionTime()); queuedTime.add(info.getQueryStats().getQueuedTime()); + elapsedTime.add(info.getQueryStats().getElapsedTime()); + analysisTime.add(info.getQueryStats().getAnalysisTime()); + planningTime.add(info.getQueryStats().getPlanningTime()); long executionWallMillis = info.getQueryStats().getExecutionTime().toMillis(); if (executionWallMillis > 0) { @@ -225,6 +231,27 @@ public TimeStat getQueuedTime() return queuedTime; } + @Managed + @Nested + public TimeStat getElapsedTime() + { + return elapsedTime; + } + + @Managed + @Nested + public TimeStat getAnalysisTime() + { + return analysisTime; + } + + @Managed + @Nested + public TimeStat getPlanningTime() + { + return planningTime; + } + @Managed @Nested public CounterStat getUserErrorFailures() diff --git a/core/trino-main/src/main/java/io/trino/execution/QueryStateMachine.java b/core/trino-main/src/main/java/io/trino/execution/QueryStateMachine.java index 90e09fad9038..78cea34e09e1 100644 --- a/core/trino-main/src/main/java/io/trino/execution/QueryStateMachine.java +++ b/core/trino-main/src/main/java/io/trino/execution/QueryStateMachine.java @@ -362,6 +362,8 @@ public BasicQueryInfo getBasicQueryInfo(Optional rootStage) queryStateTimer.getQueuedTime(), queryStateTimer.getElapsedTime(), queryStateTimer.getExecutionTime(), + queryStateTimer.getAnalysisTime(), + queryStateTimer.getPlanningTime(), stageStats.getTotalDrivers(), stageStats.getQueuedDrivers(), diff --git a/core/trino-main/src/main/java/io/trino/server/BasicQueryStats.java b/core/trino-main/src/main/java/io/trino/server/BasicQueryStats.java index b676b98b464d..2218a13c3991 100644 --- a/core/trino-main/src/main/java/io/trino/server/BasicQueryStats.java +++ b/core/trino-main/src/main/java/io/trino/server/BasicQueryStats.java @@ -44,6 +44,8 @@ public class BasicQueryStats private final Duration queuedTime; private final Duration elapsedTime; private final Duration executionTime; + private final Duration analysisTime; + private final Duration planningTime; private final int totalDrivers; private final int queuedDrivers; @@ -75,6 +77,8 @@ public BasicQueryStats( @JsonProperty("queuedTime") Duration queuedTime, @JsonProperty("elapsedTime") Duration elapsedTime, @JsonProperty("executionTime") Duration executionTime, + @JsonProperty("analysisTime") Duration analysisTime, + @JsonProperty("planningTime") Duration planningTime, @JsonProperty("totalDrivers") int totalDrivers, @JsonProperty("queuedDrivers") int queuedDrivers, @JsonProperty("runningDrivers") int runningDrivers, @@ -100,6 +104,8 @@ public BasicQueryStats( this.queuedTime = requireNonNull(queuedTime, "queuedTime is null"); this.elapsedTime = requireNonNull(elapsedTime, "elapsedTime is null"); this.executionTime = requireNonNull(executionTime, "executionTime is null"); + this.analysisTime = requireNonNull(analysisTime, "analysisTime is null"); + this.planningTime = requireNonNull(planningTime, "planningTime is null"); checkArgument(totalDrivers >= 0, "totalDrivers is negative"); this.totalDrivers = totalDrivers; @@ -136,6 +142,8 @@ public BasicQueryStats(QueryStats queryStats) queryStats.getQueuedTime(), queryStats.getElapsedTime(), queryStats.getExecutionTime(), + queryStats.getAnalysisTime(), + queryStats.getPlanningTime(), queryStats.getTotalDrivers(), queryStats.getQueuedDrivers(), queryStats.getRunningDrivers(), @@ -165,6 +173,8 @@ public static BasicQueryStats immediateFailureQueryStats() new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), + new Duration(0, MILLISECONDS), + new Duration(0, MILLISECONDS), 0, 0, 0, @@ -215,6 +225,18 @@ public Duration getExecutionTime() return executionTime; } + @JsonProperty + public Duration getAnalysisTime() + { + return analysisTime; + } + + @JsonProperty + public Duration getPlanningTime() + { + return planningTime; + } + @JsonProperty public int getTotalDrivers() { diff --git a/core/trino-main/src/test/java/io/trino/execution/MockManagedQueryExecution.java b/core/trino-main/src/test/java/io/trino/execution/MockManagedQueryExecution.java index c59d53650798..9f26a111cee3 100644 --- a/core/trino-main/src/test/java/io/trino/execution/MockManagedQueryExecution.java +++ b/core/trino-main/src/test/java/io/trino/execution/MockManagedQueryExecution.java @@ -125,6 +125,8 @@ public BasicQueryInfo getBasicQueryInfo() new Duration(3, NANOSECONDS), new Duration(4, NANOSECONDS), new Duration(5, NANOSECONDS), + new Duration(23, NANOSECONDS), + new Duration(24, NANOSECONDS), 6, 7, 8, diff --git a/core/trino-main/src/test/java/io/trino/server/TestBasicQueryInfo.java b/core/trino-main/src/test/java/io/trino/server/TestBasicQueryInfo.java index 4cfd16ddb804..849256343530 100644 --- a/core/trino-main/src/test/java/io/trino/server/TestBasicQueryInfo.java +++ b/core/trino-main/src/test/java/io/trino/server/TestBasicQueryInfo.java @@ -151,6 +151,8 @@ public void testConstructor() assertEquals(basicInfo.getQueryStats().getEndTime(), DateTime.parse("1991-09-06T06:00-05:30")); assertEquals(basicInfo.getQueryStats().getElapsedTime(), new Duration(8, MINUTES)); assertEquals(basicInfo.getQueryStats().getExecutionTime(), new Duration(44, MINUTES)); + assertEquals(basicInfo.getQueryStats().getAnalysisTime(), new Duration(9, MINUTES)); + assertEquals(basicInfo.getQueryStats().getPlanningTime(), new Duration(99, SECONDS)); assertEquals(basicInfo.getQueryStats().getTotalDrivers(), 16); assertEquals(basicInfo.getQueryStats().getQueuedDrivers(), 17); diff --git a/plugin/trino-iceberg/pom.xml b/plugin/trino-iceberg/pom.xml index 885bd979bbbd..71579c5515d8 100644 --- a/plugin/trino-iceberg/pom.xml +++ b/plugin/trino-iceberg/pom.xml @@ -141,6 +141,10 @@ org.apache.avro avro + + org.apache.httpcomponents + httpclient + diff --git a/testing/trino-tests/src/test/java/io/trino/memory/TestClusterMemoryLeakDetector.java b/testing/trino-tests/src/test/java/io/trino/memory/TestClusterMemoryLeakDetector.java index 9e65c8b0f6fd..073994c3213a 100644 --- a/testing/trino-tests/src/test/java/io/trino/memory/TestClusterMemoryLeakDetector.java +++ b/testing/trino-tests/src/test/java/io/trino/memory/TestClusterMemoryLeakDetector.java @@ -85,6 +85,8 @@ private static BasicQueryInfo createQueryInfo(String queryId, QueryState state) new Duration(8, MINUTES), new Duration(7, MINUTES), new Duration(34, MINUTES), + new Duration(35, MINUTES), + new Duration(36, MINUTES), 13, 14, 15,