diff --git a/core/trino-main/src/main/java/io/trino/execution/SqlTask.java b/core/trino-main/src/main/java/io/trino/execution/SqlTask.java index 800846836218..f3418fe5418f 100644 --- a/core/trino-main/src/main/java/io/trino/execution/SqlTask.java +++ b/core/trino-main/src/main/java/io/trino/execution/SqlTask.java @@ -218,12 +218,9 @@ else if (newState.isDone()) { switch (newState) { // don't close buffers for a failed query // closed buffers signal to upstream tasks that everything finished cleanly - case FAILED, FAILING, ABORTED, ABORTING -> - outputBuffer.abort(); - case FINISHED, CANCELED, CANCELING -> - outputBuffer.destroy(); - default -> - throw new IllegalStateException(format("Invalid state for output buffer destruction: %s", newState)); + case FAILED, FAILING, ABORTED, ABORTING -> outputBuffer.abort(); + case FINISHED, CANCELED, CANCELING -> outputBuffer.destroy(); + default -> throw new IllegalStateException(format("Invalid state for output buffer destruction: %s", newState)); } } } @@ -372,15 +369,13 @@ else if (taskHolder.getTaskExecution() != null) { fullGcTime = taskContext.getFullGcTime(); dynamicFiltersVersion = taskContext.getDynamicFiltersVersion(); } - else { - if (state == FINISHED) { - // if task FINISHED successfully but taskHolder is not yet updated with SqlTaskExecution or FinalTaskInfo - // we are masking the state and return RUNNING. This is important so coordinator would not consider incomplete - // task information (e.g. missing proper dynamicFiltersVersion as final). - // This covers only short time window between call to SqlTaskExecution.start() and updating taskHolder reference in tryCreateSqlTaskExecution, - // so it will not add any noticable delays. - state = RUNNING; - } + else if (state == FINISHED) { + // if task FINISHED successfully but taskHolder is not yet updated with SqlTaskExecution or FinalTaskInfo + // we are masking the state and return RUNNING. This is important so coordinator would not consider incomplete + // task information (e.g. missing proper dynamicFiltersVersion as final). + // This covers only short time window between call to SqlTaskExecution.start() and updating taskHolder reference in tryCreateSqlTaskExecution, + // so it will not add any noticable delays. + state = RUNNING; } return new TaskStatus(