diff --git a/presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveDynamicPartitionPruning.java b/presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveDynamicPartitionPruning.java index 3b16d282d3dd..b70ef75d9a82 100644 --- a/presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveDynamicPartitionPruning.java +++ b/presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveDynamicPartitionPruning.java @@ -16,7 +16,6 @@ import com.google.common.collect.ImmutableMap; import io.airlift.log.Logger; import io.prestosql.Session; -import io.prestosql.operator.OperatorStats; import io.prestosql.spi.QueryId; import io.prestosql.spi.predicate.Domain; import io.prestosql.spi.predicate.ValueSet; @@ -34,7 +33,6 @@ import static com.google.common.collect.Iterables.getOnlyElement; import static io.airlift.testing.Assertions.assertGreaterThan; import static io.airlift.testing.Assertions.assertGreaterThanOrEqual; -import static io.airlift.testing.Assertions.assertLessThanOrEqual; import static io.airlift.units.Duration.nanosSince; import static io.prestosql.SystemSessionProperties.JOIN_DISTRIBUTION_TYPE; import static io.prestosql.SystemSessionProperties.JOIN_REORDERING_STRATEGY; @@ -99,9 +97,8 @@ public void testJoinWithEmptyBuildSide() "SELECT * FROM partitioned_lineitem JOIN supplier ON partitioned_lineitem.suppkey = supplier.suppkey AND supplier.name = 'abc'"); assertEquals(result.getResult().getRowCount(), 0); - OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:" + PARTITIONED_LINEITEM); - assertEquals(probeStats.getInputPositions(), 0L); - assertEquals(probeStats.getDynamicFilterSplitsProcessed(), 0L); + // TODO bring back OperatorStats assertions from https://github.com/prestosql/presto/commit/1feaa0f928a02f577c8ac9ef6cc0c8ec2008a46d + // after https://github.com/prestosql/presto/issues/5120 is fixed DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId()); assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L); @@ -125,11 +122,8 @@ public void testJoinWithSelectiveBuildSide() "AND supplier.name = 'Supplier#000000001'"); assertGreaterThan(result.getResult().getRowCount(), 0); - OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:" + PARTITIONED_LINEITEM); - // Probe-side is partially scanned - // TODO change to assertEquals after https://github.com/prestosql/presto/issues/5172 - assertLessThanOrEqual(probeStats.getInputPositions(), 615L); - assertEquals(probeStats.getDynamicFilterSplitsProcessed(), 0L); + // TODO bring back OperatorStats assertions from https://github.com/prestosql/presto/commit/1feaa0f928a02f577c8ac9ef6cc0c8ec2008a46d + // after https://github.com/prestosql/presto/issues/5120 is fixed DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId()); assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L); @@ -152,11 +146,8 @@ public void testJoinWithNonSelectiveBuildSide() "SELECT * FROM partitioned_lineitem JOIN supplier ON partitioned_lineitem.suppkey = supplier.suppkey"); assertEquals(result.getResult().getRowCount(), LINEITEM_COUNT); - OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:" + PARTITIONED_LINEITEM); - // Probe-side is fully scanned - // TODO change to assertEquals after https://github.com/prestosql/presto/issues/5172 - assertLessThanOrEqual(probeStats.getInputPositions(), LINEITEM_COUNT); - assertEquals(probeStats.getDynamicFilterSplitsProcessed(), 0L); + // TODO bring back OperatorStats assertions from https://github.com/prestosql/presto/commit/1feaa0f928a02f577c8ac9ef6cc0c8ec2008a46d + // after https://github.com/prestosql/presto/issues/5120 is fixed DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId()); assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L); @@ -181,11 +172,8 @@ public void testJoinLargeBuildSideNoDynamicFiltering() "SELECT * FROM partitioned_lineitem JOIN orders ON partitioned_lineitem.orderkey = orders.orderkey"); assertEquals(result.getResult().getRowCount(), LINEITEM_COUNT); - OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:" + PARTITIONED_LINEITEM); - // Probe-side is fully scanned because the build-side is too large for dynamic filtering - // TODO change to assertEquals after https://github.com/prestosql/presto/issues/5172 - assertLessThanOrEqual(probeStats.getInputPositions(), LINEITEM_COUNT); - assertEquals(probeStats.getDynamicFilterSplitsProcessed(), 0L); + // TODO bring back OperatorStats assertions from https://github.com/prestosql/presto/commit/1feaa0f928a02f577c8ac9ef6cc0c8ec2008a46d + // after https://github.com/prestosql/presto/issues/5120 is fixed DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId()); assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L); @@ -212,11 +200,8 @@ public void testJoinWithMultipleDynamicFiltersOnProbe() ") t JOIN supplier ON t.suppkey = supplier.suppkey AND supplier.suppkey IN (2, 3)"); assertGreaterThan(result.getResult().getRowCount(), 0); - OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:" + PARTITIONED_LINEITEM); - // Probe-side is partially scanned - // TODO change to assertEquals after https://github.com/prestosql/presto/issues/5172 - assertLessThanOrEqual(probeStats.getInputPositions(), 558L); - assertEquals(probeStats.getDynamicFilterSplitsProcessed(), 0L); + // TODO bring back OperatorStats assertions from https://github.com/prestosql/presto/commit/1feaa0f928a02f577c8ac9ef6cc0c8ec2008a46d + // after https://github.com/prestosql/presto/issues/5120 is fixed DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId()); assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 2L); @@ -241,9 +226,8 @@ public void testSemiJoinWithEmptyBuildSide() "SELECT * FROM partitioned_lineitem WHERE suppkey IN (SELECT suppkey FROM supplier WHERE name = 'abc')"); assertEquals(result.getResult().getRowCount(), 0); - OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:" + PARTITIONED_LINEITEM); - assertEquals(probeStats.getInputPositions(), 0L); - assertEquals(probeStats.getDynamicFilterSplitsProcessed(), 0L); + // TODO bring back OperatorStats assertions from https://github.com/prestosql/presto/commit/0fb16ab9d9c990e58fad63d4dab3dbbe482a077d + // after https://github.com/prestosql/presto/issues/5120 is fixed DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId()); assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L); @@ -266,11 +250,8 @@ public void testSemiJoinWithSelectiveBuildSide() "SELECT * FROM partitioned_lineitem WHERE suppkey IN (SELECT suppkey FROM supplier WHERE name = 'Supplier#000000001')"); assertGreaterThan(result.getResult().getRowCount(), 0); - OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:" + PARTITIONED_LINEITEM); - // Probe-side is partially scanned - // TODO change to assertEquals after https://github.com/prestosql/presto/issues/5172 - assertLessThanOrEqual(probeStats.getInputPositions(), 615L); - assertEquals(probeStats.getDynamicFilterSplitsProcessed(), 0L); + // TODO bring back OperatorStats assertions from https://github.com/prestosql/presto/commit/0fb16ab9d9c990e58fad63d4dab3dbbe482a077d + // after https://github.com/prestosql/presto/issues/5120 is fixed DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId()); assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L); @@ -293,11 +274,8 @@ public void testSemiJoinWithNonSelectiveBuildSide() "SELECT * FROM partitioned_lineitem WHERE suppkey IN (SELECT suppkey FROM supplier)"); assertGreaterThan(result.getResult().getRowCount(), 0); - OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:" + PARTITIONED_LINEITEM); - // Probe-side is fully scanned - // TODO change to assertEquals after https://github.com/prestosql/presto/issues/5172 - assertLessThanOrEqual(probeStats.getInputPositions(), LINEITEM_COUNT); - assertEquals(probeStats.getDynamicFilterSplitsProcessed(), 0L); + // TODO bring back OperatorStats assertions from https://github.com/prestosql/presto/commit/0fb16ab9d9c990e58fad63d4dab3dbbe482a077d + // after https://github.com/prestosql/presto/issues/5120 is fixed DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId()); assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L); @@ -322,11 +300,8 @@ public void testSemiJoinLargeBuildSideNoDynamicFiltering() "SELECT * FROM partitioned_lineitem WHERE orderkey IN (SELECT orderkey FROM orders)"); assertEquals(result.getResult().getRowCount(), LINEITEM_COUNT); - OperatorStats probeStats = searchScanFilterAndProjectOperatorStats(result.getQueryId(), "tpch:" + PARTITIONED_LINEITEM); - // Probe-side is fully scanned because the build-side is too large for dynamic filtering - // TODO change to assertEquals after https://github.com/prestosql/presto/issues/5172 - assertLessThanOrEqual(probeStats.getInputPositions(), LINEITEM_COUNT); - assertEquals(probeStats.getDynamicFilterSplitsProcessed(), 0L); + // TODO bring back OperatorStats assertions from https://github.com/prestosql/presto/commit/0fb16ab9d9c990e58fad63d4dab3dbbe482a077d + // after https://github.com/prestosql/presto/issues/5120 is fixed DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.getQueryId()); assertEquals(dynamicFiltersStats.getTotalDynamicFilters(), 1L); diff --git a/presto-testing/src/main/java/io/prestosql/testing/AbstractTestQueryFramework.java b/presto-testing/src/main/java/io/prestosql/testing/AbstractTestQueryFramework.java index f6ebf675b5c3..e7e319d10f6a 100644 --- a/presto-testing/src/main/java/io/prestosql/testing/AbstractTestQueryFramework.java +++ b/presto-testing/src/main/java/io/prestosql/testing/AbstractTestQueryFramework.java @@ -61,7 +61,6 @@ 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; @@ -72,11 +71,9 @@ 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; @@ -453,7 +450,7 @@ protected OperatorStats searchScanFilterAndProjectOperatorStats(QueryId queryId, .findOnlyElement() .getId(); - Supplier operatorStatsSupplier = () -> runner.getCoordinator() + return runner.getCoordinator() .getQueryManager() .getFullQueryInfo(queryId) .getQueryStats() @@ -461,7 +458,5 @@ protected OperatorStats searchScanFilterAndProjectOperatorStats(QueryId queryId, .stream() .filter(summary -> nodeId.equals(summary.getPlanNodeId()) && summary.getOperatorType().equals("ScanFilterAndProjectOperator")) .collect(MoreCollectors.onlyElement()); - assertEventually(new Duration(5, SECONDS), operatorStatsSupplier::get); - return operatorStatsSupplier.get(); } }