Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require 1+ retained node for isNotFullyPushedDown check #16017

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Require 1+ retained node for isNotFullyPushedDown check
It was always the original intention, let's enforce it with the type
system.
  • Loading branch information
findepi committed Feb 8, 2023
commit 6ead9285762b64c0358d318b1cfa8e893a402f65
Original file line number Diff line number Diff line change
@@ -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<? extends PlanNode>... retainedNodes)
public final QueryAssert isNotFullyPushedDown(Class<? extends PlanNode> firstRetainedNode, Class<? extends PlanNode>... moreRetainedNodes)
{
PlanMatchPattern expectedPlan = PlanMatchPattern.node(TableScanNode.class);
List<Class<? extends PlanNode>> retainedNodes = Lists.asList(firstRetainedNode, moreRetainedNodes);
for (Class<? extends PlanNode> retainedNode : ImmutableList.copyOf(retainedNodes).reverse()) {
expectedPlan = PlanMatchPattern.node(retainedNode, expectedPlan);
}
Original file line number Diff line number Diff line change
@@ -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"))