Skip to content

Commit

Permalink
Wait for final QueryInfo before using in test
Browse files Browse the repository at this point in the history
  • Loading branch information
raunaqmorarka authored and sopel39 committed Sep 11, 2020
1 parent cb300dc commit 99647e9
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.prestosql.cost.CostCalculatorWithEstimatedExchanges;
import io.prestosql.cost.CostComparator;
import io.prestosql.cost.TaskCountEstimator;
import io.prestosql.execution.QueryInfo;
import io.prestosql.execution.QueryManagerConfig;
import io.prestosql.execution.TaskManagerConfig;
import io.prestosql.execution.warnings.WarningCollector;
Expand Down Expand Up @@ -61,6 +62,7 @@
import java.util.Optional;
import java.util.OptionalLong;
import java.util.function.Consumer;
import java.util.function.Supplier;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
Expand All @@ -71,9 +73,11 @@
import static io.prestosql.SystemSessionProperties.JOIN_REORDERING_STRATEGY;
import static io.prestosql.sql.ParsingUtil.createParsingOptions;
import static io.prestosql.sql.SqlFormatter.formatSql;
import static io.prestosql.testing.assertions.Assert.assertEventually;
import static io.prestosql.transaction.TransactionBuilder.transaction;
import static java.lang.String.format;
import static java.util.Collections.emptyList;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;
Expand Down Expand Up @@ -446,9 +450,13 @@ protected OperatorStats searchScanFilterAndProjectOperatorStats(QueryId queryId,
})
.findOnlyElement()
.getId();
return runner.getCoordinator()

Supplier<QueryInfo> queryInfoSupplier = () -> runner.getCoordinator()
.getQueryManager()
.getFullQueryInfo(queryId)
.getFullQueryInfo(queryId);
assertEventually(new Duration(5, SECONDS), () -> assertThat(queryInfoSupplier.get().isFinalQueryInfo()));

return queryInfoSupplier.get()
.getQueryStats()
.getOperatorSummaries()
.stream()
Expand Down

0 comments on commit 99647e9

Please sign in to comment.