From 6ead9285762b64c0358d318b1cfa8e893a402f65 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Tue, 7 Feb 2023 18:10:44 +0100 Subject: [PATCH] Require 1+ retained node for isNotFullyPushedDown check It was always the original intention, let's enforce it with the type system. --- .../src/test/java/io/trino/sql/query/QueryAssertions.java | 4 +++- .../pinot/BasePinotIntegrationConnectorSmokeTest.java | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/trino-main/src/test/java/io/trino/sql/query/QueryAssertions.java b/core/trino-main/src/test/java/io/trino/sql/query/QueryAssertions.java index 179bf4889b9e..871be7977ad5 100644 --- a/core/trino-main/src/test/java/io/trino/sql/query/QueryAssertions.java +++ b/core/trino-main/src/test/java/io/trino/sql/query/QueryAssertions.java @@ -15,6 +15,7 @@ import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; import io.trino.Session; import io.trino.execution.warnings.WarningCollector; import io.trino.metadata.FunctionBundle; @@ -505,9 +506,10 @@ public QueryAssert isFullyPushedDown() */ @SafeVarargs @CanIgnoreReturnValue - public final QueryAssert isNotFullyPushedDown(Class... retainedNodes) + public final QueryAssert isNotFullyPushedDown(Class firstRetainedNode, Class... moreRetainedNodes) { PlanMatchPattern expectedPlan = PlanMatchPattern.node(TableScanNode.class); + List> retainedNodes = Lists.asList(firstRetainedNode, moreRetainedNodes); for (Class retainedNode : ImmutableList.copyOf(retainedNodes).reverse()) { expectedPlan = PlanMatchPattern.node(retainedNode, expectedPlan); } diff --git a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/BasePinotIntegrationConnectorSmokeTest.java b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/BasePinotIntegrationConnectorSmokeTest.java index 62194425ed08..5762b9816c69 100644 --- a/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/BasePinotIntegrationConnectorSmokeTest.java +++ b/plugin/trino-pinot/src/test/java/io/trino/plugin/pinot/BasePinotIntegrationConnectorSmokeTest.java @@ -1759,7 +1759,7 @@ public void testAggregationPushdown() .isFullyPushedDown(); // Distinct on int is partially pushed down assertThat(query("SELECT DISTINCT int_col FROM " + ALL_TYPES_TABLE)) - .isNotFullyPushedDown(); + .isFullyPushedDown(); // Distinct on 2 columns for supported types: assertThat(query("SELECT DISTINCT bool_col, string_col FROM " + ALL_TYPES_TABLE)) @@ -1773,7 +1773,7 @@ public void testAggregationPushdown() assertThat(query("SELECT DISTINCT bool_col, timestamp_col FROM " + ALL_TYPES_TABLE)) .isFullyPushedDown(); assertThat(query("SELECT DISTINCT bool_col, int_col FROM " + ALL_TYPES_TABLE)) - .isNotFullyPushedDown(); + .isFullyPushedDown(); // Test distinct for mixed case values assertThat(query("SELECT DISTINCT string_col FROM " + MIXED_CASE_DISTINCT_TABLE)) @@ -1804,7 +1804,7 @@ public void testAggregationPushdown() .isFullyPushedDown(); // Approx distinct on int is partially pushed down assertThat(query("SELECT approx_distinct(int_col) FROM " + ALL_TYPES_TABLE)) - .isNotFullyPushedDown(); + .isFullyPushedDown(); // Approx distinct on 2 columns for supported types: assertThat(query("SELECT bool_col, approx_distinct(string_col) FROM " + ALL_TYPES_TABLE + " GROUP BY bool_col")) @@ -1816,7 +1816,7 @@ public void testAggregationPushdown() assertThat(query("SELECT bool_col, approx_distinct(long_col) FROM " + ALL_TYPES_TABLE + " GROUP BY bool_col")) .isFullyPushedDown(); assertThat(query("SELECT bool_col, approx_distinct(int_col) FROM " + ALL_TYPES_TABLE + " GROUP BY bool_col")) - .isNotFullyPushedDown(); + .isFullyPushedDown(); // Distinct count is fully pushed down by default assertThat(query("SELECT bool_col, COUNT(DISTINCT string_col) FROM " + ALL_TYPES_TABLE + " GROUP BY bool_col"))