From 2e40a771a99d3939c214f8ce9f9db5223e277d2f Mon Sep 17 00:00:00 2001 From: Karol Sobczak Date: Thu, 22 Aug 2024 15:54:55 +0200 Subject: [PATCH 1/2] Expose query starting time Reported query start time is computed after call to SplitSourceFactory#createSplitSources, and that method may take a lot of time for some connectors. --- .../java/io/trino/dispatcher/FailedDispatchQuery.java | 1 + .../main/java/io/trino/execution/QueryStateMachine.java | 2 ++ .../main/java/io/trino/execution/QueryStateTimer.java | 9 +++++++++ .../src/main/java/io/trino/execution/QueryStats.java | 9 +++++++++ .../io/trino/execution/MockManagedQueryExecution.java | 1 + .../src/test/java/io/trino/execution/TestQueryStats.java | 2 ++ .../test/java/io/trino/server/TestBasicQueryInfo.java | 1 + .../test/java/io/trino/server/TestQueryStateInfo.java | 1 + 8 files changed, 26 insertions(+) diff --git a/core/trino-main/src/main/java/io/trino/dispatcher/FailedDispatchQuery.java b/core/trino-main/src/main/java/io/trino/dispatcher/FailedDispatchQuery.java index 3a694d4ee9094..1e1f00a645cbb 100644 --- a/core/trino-main/src/main/java/io/trino/dispatcher/FailedDispatchQuery.java +++ b/core/trino-main/src/main/java/io/trino/dispatcher/FailedDispatchQuery.java @@ -277,6 +277,7 @@ private static QueryStats immediateFailureQueryStats() new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), new Duration(0, MILLISECONDS), + new Duration(0, MILLISECONDS), 0, 0, 0, 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 65515baee776b..32dd0dc665ff2 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 @@ -825,6 +825,7 @@ private QueryStats getQueryStats(Optional rootStage, List queryStateTimer.getAnalysisTime(), queryStateTimer.getPlanningTime(), queryStateTimer.getPlanningCpuTime(), + queryStateTimer.getStartingTime(), queryStateTimer.getFinishingTime(), totalTasks, @@ -1435,6 +1436,7 @@ private static QueryStats pruneQueryStats(QueryStats queryStats) queryStats.getAnalysisTime(), queryStats.getPlanningTime(), queryStats.getPlanningCpuTime(), + queryStats.getStartingTime(), queryStats.getFinishingTime(), queryStats.getTotalTasks(), queryStats.getRunningTasks(), diff --git a/core/trino-main/src/main/java/io/trino/execution/QueryStateTimer.java b/core/trino-main/src/main/java/io/trino/execution/QueryStateTimer.java index d1642ab47cc8f..25f0fa866b867 100644 --- a/core/trino-main/src/main/java/io/trino/execution/QueryStateTimer.java +++ b/core/trino-main/src/main/java/io/trino/execution/QueryStateTimer.java @@ -40,6 +40,7 @@ class QueryStateTimer private final AtomicReference beginDispatchingNanos = new AtomicReference<>(); private final AtomicReference beginPlanningNanos = new AtomicReference<>(); private final AtomicReference beginPlanningCpuNanos = new AtomicReference<>(); + private final AtomicReference beginStartingNanos = new AtomicReference<>(); private final AtomicReference beginFinishingNanos = new AtomicReference<>(); private final AtomicReference endNanos = new AtomicReference<>(); @@ -49,6 +50,7 @@ class QueryStateTimer private final AtomicReference executionTime = new AtomicReference<>(); private final AtomicReference planningTime = new AtomicReference<>(); private final AtomicReference planningCpuTime = new AtomicReference<>(); + private final AtomicReference startingTime = new AtomicReference<>(); private final AtomicReference finishingTime = new AtomicReference<>(); private final AtomicReference beginAnalysisNanos = new AtomicReference<>(); @@ -113,6 +115,7 @@ private void beginStarting(long now, long cpuNow) beginPlanning(now, cpuNow); planningTime.compareAndSet(null, nanosSince(beginPlanningNanos, now)); planningCpuTime.compareAndSet(null, nanosSince(beginPlanningCpuNanos, cpuNow)); + beginStartingNanos.compareAndSet(null, now); } public void beginRunning() @@ -123,6 +126,7 @@ public void beginRunning() private void beginRunning(long now) { beginStarting(now, currentThreadCpuTime()); + startingTime.compareAndSet(null, nanosSince(beginStartingNanos, now)); } public void beginFinishing() @@ -240,6 +244,11 @@ public Duration getPlanningCpuTime() return getDuration(planningCpuTime, beginPlanningCpuNanos); } + public Duration getStartingTime() + { + return getDuration(startingTime, beginStartingNanos); + } + public Duration getFinishingTime() { return getDuration(finishingTime, beginFinishingNanos); diff --git a/core/trino-main/src/main/java/io/trino/execution/QueryStats.java b/core/trino-main/src/main/java/io/trino/execution/QueryStats.java index ad590980def7b..bdb0b08a5431f 100644 --- a/core/trino-main/src/main/java/io/trino/execution/QueryStats.java +++ b/core/trino-main/src/main/java/io/trino/execution/QueryStats.java @@ -53,6 +53,7 @@ public class QueryStats private final Duration analysisTime; private final Duration planningTime; private final Duration planningCpuTime; + private final Duration startingTime; private final Duration finishingTime; private final int totalTasks; @@ -147,6 +148,7 @@ public QueryStats( @JsonProperty("analysisTime") Duration analysisTime, @JsonProperty("planningTime") Duration planningTime, @JsonProperty("planningCpuTime") Duration planningCpuTime, + @JsonProperty("startingTime") Duration startingTime, @JsonProperty("finishingTime") Duration finishingTime, @JsonProperty("totalTasks") int totalTasks, @@ -239,6 +241,7 @@ public QueryStats( this.analysisTime = requireNonNull(analysisTime, "analysisTime is null"); this.planningTime = requireNonNull(planningTime, "planningTime is null"); this.planningCpuTime = requireNonNull(planningCpuTime, "planningCpuTime is null"); + this.startingTime = requireNonNull(startingTime, "startingTime is null"); this.finishingTime = requireNonNull(finishingTime, "finishingTime is null"); checkArgument(totalTasks >= 0, "totalTasks is negative"); @@ -410,6 +413,12 @@ public Duration getPlanningCpuTime() return planningCpuTime; } + @JsonProperty + public Duration getStartingTime() + { + return startingTime; + } + @JsonProperty public Duration getFinishingTime() { 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 accbb395618fd..9b3d998c0540d 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 @@ -181,6 +181,7 @@ public QueryInfo getFullQueryInfo() new Duration(100, NANOSECONDS), new Duration(150, NANOSECONDS), + new Duration(160, NANOSECONDS), new Duration(200, NANOSECONDS), 9, diff --git a/core/trino-main/src/test/java/io/trino/execution/TestQueryStats.java b/core/trino-main/src/test/java/io/trino/execution/TestQueryStats.java index 700117c20807f..8a296fd77d5fc 100644 --- a/core/trino-main/src/test/java/io/trino/execution/TestQueryStats.java +++ b/core/trino-main/src/test/java/io/trino/execution/TestQueryStats.java @@ -192,6 +192,7 @@ public class TestQueryStats new Duration(100, NANOSECONDS), new Duration(150, NANOSECONDS), + new Duration(160, NANOSECONDS), new Duration(200, NANOSECONDS), 9, @@ -305,6 +306,7 @@ public static void assertExpectedQueryStats(QueryStats actual) assertThat(actual.getPlanningTime()).isEqualTo(new Duration(100, NANOSECONDS)); assertThat(actual.getPlanningCpuTime()).isEqualTo(new Duration(150, NANOSECONDS)); + assertThat(actual.getStartingTime()).isEqualTo(new Duration(160, NANOSECONDS)); assertThat(actual.getFinishingTime()).isEqualTo(new Duration(200, NANOSECONDS)); assertThat(actual.getTotalTasks()).isEqualTo(9); 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 be5cbfc1eec27..f543cdaac64be 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 @@ -68,6 +68,7 @@ public void testConstructor() new Duration(9, MINUTES), new Duration(99, SECONDS), new Duration(1, SECONDS), + new Duration(2, SECONDS), new Duration(12, MINUTES), 13, 14, diff --git a/core/trino-main/src/test/java/io/trino/server/TestQueryStateInfo.java b/core/trino-main/src/test/java/io/trino/server/TestQueryStateInfo.java index 7779ab97f86da..d6b7c46349a0c 100644 --- a/core/trino-main/src/test/java/io/trino/server/TestQueryStateInfo.java +++ b/core/trino-main/src/test/java/io/trino/server/TestQueryStateInfo.java @@ -120,6 +120,7 @@ private QueryInfo createQueryInfo(String queryId, QueryState state, String query new Duration(10, MINUTES), new Duration(11, MINUTES), new Duration(1, SECONDS), + new Duration(2, SECONDS), new Duration(12, MINUTES), 13, 14, From 64e75bdcf74e3ba054b0812eaf5dd92a8e5543f1 Mon Sep 17 00:00:00 2001 From: Karol Sobczak Date: Fri, 23 Aug 2024 11:45:49 +0200 Subject: [PATCH 2/2] Expose starting time to event listener --- .../src/main/java/io/trino/event/QueryMonitor.java | 2 ++ core/trino-spi/pom.xml | 6 ++++++ .../io/trino/spi/eventlistener/QueryStatistics.java | 11 +++++++++++ .../trino/plugin/httpquery/TestHttpEventListener.java | 1 + .../plugin/httpquery/TestHttpServerEventListener.java | 1 + .../trino/plugin/eventlistener/kafka/TestUtils.java | 1 + .../eventlistener/mysql/MysqlEventListener.java | 1 + .../io/trino/plugin/eventlistener/mysql/QueryDao.java | 3 +++ .../trino/plugin/eventlistener/mysql/QueryEntity.java | 8 ++++++++ .../eventlistener/mysql/TestMysqlEventListener.java | 3 +++ .../io/trino/plugin/openlineage/TrinoEventData.java | 1 + 11 files changed, 38 insertions(+) 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 2efbf816c1ba7..a86bda27fe319 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 @@ -209,6 +209,7 @@ public void queryImmediateFailureEvent(BasicQueryInfo queryInfo, ExecutionFailur Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), 0, 0, 0, @@ -317,6 +318,7 @@ private QueryStatistics createQueryStatistics(QueryInfo queryInfo) Optional.of(ofMillis(queryStats.getAnalysisTime().toMillis())), Optional.of(ofMillis(queryStats.getPlanningTime().toMillis())), Optional.of(ofMillis(queryStats.getPlanningCpuTime().toMillis())), + Optional.of(ofMillis(queryStats.getStartingTime().toMillis())), Optional.of(ofMillis(queryStats.getExecutionTime().toMillis())), Optional.of(ofMillis(queryStats.getInputBlockedTime().toMillis())), Optional.of(ofMillis(queryStats.getFailedInputBlockedTime().toMillis())), diff --git a/core/trino-spi/pom.xml b/core/trino-spi/pom.xml index ebf18ba7e6032..5e2af635249f5 100644 --- a/core/trino-spi/pom.xml +++ b/core/trino-spi/pom.xml @@ -235,6 +235,12 @@ method void io.trino.spi.eventlistener.QueryStatistics::<init>(java.time.Duration, java.time.Duration, java.time.Duration, java.time.Duration, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, double, double, java.util.List<io.trino.spi.eventlistener.StageGcStatistics>, int, boolean, java.util.List<io.trino.spi.eventlistener.StageCpuDistribution>, java.util.List<io.trino.spi.eventlistener.StageOutputBufferUtilization>, java.util.function.Supplier<java.util.List<java.lang.String>>, java.util.List<io.trino.spi.eventlistener.QueryPlanOptimizerStatistics>, java.util.Optional<java.lang.String>) method void io.trino.spi.eventlistener.QueryStatistics::<init>(java.time.Duration, java.time.Duration, java.time.Duration, java.time.Duration, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, double, double, java.util.List<io.trino.spi.eventlistener.StageGcStatistics>, int, boolean, java.util.List<io.trino.spi.eventlistener.StageCpuDistribution>, java.util.List<io.trino.spi.eventlistener.StageOutputBufferUtilization>, java.util.List<io.trino.spi.eventlistener.StageTaskStatistics>, java.util.function.Supplier<java.util.List<java.lang.String>>, java.util.List<io.trino.spi.eventlistener.QueryPlanOptimizerStatistics>, java.util.Optional<java.lang.String>) + + true + java.method.numberOfParametersChanged + method void io.trino.spi.eventlistener.QueryStatistics::<init>(java.time.Duration, java.time.Duration, java.time.Duration, java.time.Duration, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, double, double, java.util.List<io.trino.spi.eventlistener.StageGcStatistics>, int, boolean, java.util.List<io.trino.spi.eventlistener.StageCpuDistribution>, java.util.List<io.trino.spi.eventlistener.StageOutputBufferUtilization>, java.util.List<io.trino.spi.eventlistener.StageTaskStatistics>, java.util.function.Supplier<java.util.List<java.lang.String>>, java.util.List<io.trino.spi.eventlistener.QueryPlanOptimizerStatistics>, java.util.Optional<java.lang.String>) + method void io.trino.spi.eventlistener.QueryStatistics::<init>(java.time.Duration, java.time.Duration, java.time.Duration, java.time.Duration, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, java.util.Optional<java.time.Duration>, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, long, double, double, java.util.List<io.trino.spi.eventlistener.StageGcStatistics>, int, boolean, java.util.List<io.trino.spi.eventlistener.StageCpuDistribution>, java.util.List<io.trino.spi.eventlistener.StageOutputBufferUtilization>, java.util.List<io.trino.spi.eventlistener.StageTaskStatistics>, java.util.function.Supplier<java.util.List<java.lang.String>>, java.util.List<io.trino.spi.eventlistener.QueryPlanOptimizerStatistics>, java.util.Optional<java.lang.String>) + java.method.numberOfParametersChanged method io.trino.spi.predicate.SortedRangeSet io.trino.spi.predicate.SortedRangeSet::fromJson(io.trino.spi.type.Type, boolean[], io.trino.spi.block.Block) 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 2ca79eed6f3c1..dc5f0c6e7bb6b 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 @@ -39,6 +39,7 @@ public class QueryStatistics private final Optional analysisTime; private final Optional planningTime; private final Optional planningCpuTime; + private final Optional startingTime; private final Optional executionTime; private final Optional inputBlockedTime; private final Optional failedInputBlockedTime; @@ -100,6 +101,7 @@ public QueryStatistics( Optional analysisTime, Optional planningTime, Optional planningCpuTime, + Optional startingTime, Optional executionTime, Optional inputBlockedTime, Optional failedInputBlockedTime, @@ -145,6 +147,7 @@ public QueryStatistics( analysisTime, planningTime, planningCpuTime, + startingTime, executionTime, inputBlockedTime, failedInputBlockedTime, @@ -191,6 +194,7 @@ public QueryStatistics( Optional analysisTime, Optional planningTime, Optional planningCpuTime, + Optional startingTime, Optional executionTime, Optional inputBlockedTime, Optional failedInputBlockedTime, @@ -235,6 +239,7 @@ public QueryStatistics( this.analysisTime = requireNonNull(analysisTime, "analysisTime is null"); this.planningTime = requireNonNull(planningTime, "planningTime is null"); this.planningCpuTime = requireNonNull(planningCpuTime, "planningCpuTime is null"); + this.startingTime = requireNonNull(startingTime, "startingTime is null"); this.executionTime = requireNonNull(executionTime, "executionTime is null"); this.inputBlockedTime = requireNonNull(inputBlockedTime, "inputBlockedTime is null"); this.failedInputBlockedTime = requireNonNull(failedInputBlockedTime, "failedInputBlockedTime is null"); @@ -330,6 +335,12 @@ public Optional getPlanningCpuTime() return planningCpuTime; } + @JsonProperty + public Optional getStartingTime() + { + return startingTime; + } + @JsonProperty public Optional getExecutionTime() { 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 e12c48e6c93b6..bf6fff2debcbc 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 @@ -166,6 +166,7 @@ final class TestHttpEventListener Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), 0L, 0L, 0L, diff --git a/plugin/trino-http-server-event-listener/src/test/java/io/trino/plugin/httpquery/TestHttpServerEventListener.java b/plugin/trino-http-server-event-listener/src/test/java/io/trino/plugin/httpquery/TestHttpServerEventListener.java index ea66cf657820c..225ca523ffdea 100644 --- a/plugin/trino-http-server-event-listener/src/test/java/io/trino/plugin/httpquery/TestHttpServerEventListener.java +++ b/plugin/trino-http-server-event-listener/src/test/java/io/trino/plugin/httpquery/TestHttpServerEventListener.java @@ -136,6 +136,7 @@ final class TestHttpServerEventListener Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), 0L, 0L, 0L, diff --git a/plugin/trino-kafka-event-listener/src/test/java/io/trino/plugin/eventlistener/kafka/TestUtils.java b/plugin/trino-kafka-event-listener/src/test/java/io/trino/plugin/eventlistener/kafka/TestUtils.java index 7c1f56cb6bb89..fd9fd3372f82c 100644 --- a/plugin/trino-kafka-event-listener/src/test/java/io/trino/plugin/eventlistener/kafka/TestUtils.java +++ b/plugin/trino-kafka-event-listener/src/test/java/io/trino/plugin/eventlistener/kafka/TestUtils.java @@ -131,6 +131,7 @@ private TestUtils() Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), 0L, 0L, 0L, diff --git a/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/MysqlEventListener.java b/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/MysqlEventListener.java index 0fff350fcac1f..c68868985090c 100644 --- a/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/MysqlEventListener.java +++ b/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/MysqlEventListener.java @@ -137,6 +137,7 @@ public void queryCompleted(QueryCompletedEvent event) stats.getAnalysisTime().map(Duration::toMillis).orElse(0L), stats.getPlanningTime().map(Duration::toMillis).orElse(0L), stats.getPlanningCpuTime().map(Duration::toMillis).orElse(0L), + stats.getStartingTime().map(Duration::toMillis).orElse(0L), stats.getExecutionTime().map(Duration::toMillis).orElse(0L), stats.getInputBlockedTime().map(Duration::toMillis).orElse(0L), stats.getFailedInputBlockedTime().map(Duration::toMillis).orElse(0L), diff --git a/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/QueryDao.java b/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/QueryDao.java index 79d4bf789a9bc..278cfdaf3f75c 100644 --- a/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/QueryDao.java +++ b/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/QueryDao.java @@ -63,6 +63,7 @@ public interface QueryDao " analysis_time_millis BIGINT NOT NULL,\n" + " planning_time_millis BIGINT NOT NULL,\n" + " planning_cpu_time_millis BIGINT NOT NULL,\n" + + " starting_time_millis BIGINT NOT NULL,\n" + " execution_time_millis BIGINT NOT NULL,\n" + " input_blocked_time_millis BIGINT NOT NULL,\n" + " failed_input_blocked_time_millis BIGINT NOT NULL,\n" + @@ -135,6 +136,7 @@ public interface QueryDao " analysis_time_millis,\n" + " planning_time_millis,\n" + " planning_cpu_time_millis,\n" + + " starting_time_millis,\n" + " execution_time_millis,\n" + " input_blocked_time_millis,\n" + " failed_input_blocked_time_millis,\n" + @@ -204,6 +206,7 @@ public interface QueryDao " :analysisTimeMillis,\n" + " :planningTimeMillis,\n" + " :planningCpuTimeMillis,\n" + + " :startingTimeMillis,\n" + " :executionTimeMillis,\n" + " :inputBlockedTimeMillis,\n" + " :failedInputBlockedTimeMillis,\n" + diff --git a/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/QueryEntity.java b/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/QueryEntity.java index 209a016c33296..3bd6fb7d2acf7 100644 --- a/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/QueryEntity.java +++ b/plugin/trino-mysql-event-listener/src/main/java/io/trino/plugin/eventlistener/mysql/QueryEntity.java @@ -74,6 +74,7 @@ public class QueryEntity private final long analysisTimeMillis; private final long planningTimeMillis; private final long planningCpuTimeMillis; + private final long startingTimeMillis; private final long executionTimeMillis; private final long inputBlockedTimeMillis; private final long failedInputBlockedTimeMillis; @@ -147,6 +148,7 @@ public QueryEntity( long analysisTimeMillis, long planningTimeMillis, long planningCpuTimeMillis, + long startingTimeMillis, long executionTimeMillis, long inputBlockedTimeMillis, long failedInputBlockedTimeMillis, @@ -215,6 +217,7 @@ public QueryEntity( this.analysisTimeMillis = analysisTimeMillis; this.planningTimeMillis = planningTimeMillis; this.planningCpuTimeMillis = planningCpuTimeMillis; + this.startingTimeMillis = startingTimeMillis; this.executionTimeMillis = executionTimeMillis; this.inputBlockedTimeMillis = inputBlockedTimeMillis; this.failedInputBlockedTimeMillis = failedInputBlockedTimeMillis; @@ -460,6 +463,11 @@ public long getPlanningCpuTimeMillis() return planningCpuTimeMillis; } + public long getStartingTimeMillis() + { + return startingTimeMillis; + } + public long getExecutionTimeMillis() { return executionTimeMillis; 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 da9eb686fc833..fb8901be9ce5e 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 @@ -95,6 +95,7 @@ final class TestMysqlEventListener Optional.of(ofMillis(108)), Optional.of(ofMillis(109)), Optional.of(ofMillis(1091)), + Optional.of(ofMillis(1092)), Optional.of(ofMillis(110)), Optional.of(ofMillis(111)), Optional.of(ofMillis(112)), @@ -260,6 +261,7 @@ final class TestMysqlEventListener Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), 115L, 116L, 117L, @@ -424,6 +426,7 @@ void testFull() assertThat(resultSet.getLong("analysis_time_millis")).isEqualTo(108); assertThat(resultSet.getLong("planning_time_millis")).isEqualTo(109); assertThat(resultSet.getLong("planning_cpu_time_millis")).isEqualTo(1091); + assertThat(resultSet.getLong("starting_time_millis")).isEqualTo(1092); assertThat(resultSet.getLong("execution_time_millis")).isEqualTo(110); assertThat(resultSet.getLong("input_blocked_time_millis")).isEqualTo(111); assertThat(resultSet.getLong("failed_input_blocked_time_millis")).isEqualTo(112); diff --git a/plugin/trino-openlineage/src/test/java/io/trino/plugin/openlineage/TrinoEventData.java b/plugin/trino-openlineage/src/test/java/io/trino/plugin/openlineage/TrinoEventData.java index f4d847a1c9182..3db745e63ca75 100644 --- a/plugin/trino-openlineage/src/test/java/io/trino/plugin/openlineage/TrinoEventData.java +++ b/plugin/trino-openlineage/src/test/java/io/trino/plugin/openlineage/TrinoEventData.java @@ -109,6 +109,7 @@ private TrinoEventData() Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), 0L, 0L, 0L,