presto-main/src/main/java/io/prestosql/execution/QueryInfo.java/QueryInfo/isFinalQueryInfo
class QueryInfo:    @JsonProperty
    public boolean isFinalQueryInfo()
    {
        return state.isDone() && getAllStages(outputStage).stream().allMatch(StageInfo::isFinalStageInfo);
    }