Skip to content

Commit

Permalink
Rename rule consuming preferred write partitioning
Browse files Browse the repository at this point in the history
"determine preferred writer partitioning" suggested that the rule
determines what is the preferred partitioning. The rule determines
actual partitioning, taking preferred partitioning as the input.

Additionally, "Write" is replaced with "TableWriter" in rule name, to
indicate this works with `TableWriterNode`.
  • Loading branch information
findepi committed Nov 4, 2021
1 parent 439d386 commit d10cb87
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import io.trino.sql.planner.iterative.RuleStats;
import io.trino.sql.planner.iterative.rule.AddExchangesBelowPartialAggregationOverGroupIdRuleSet;
import io.trino.sql.planner.iterative.rule.AddIntermediateAggregations;
import io.trino.sql.planner.iterative.rule.ApplyPreferredTableExecutePartitioning;
import io.trino.sql.planner.iterative.rule.ApplyPreferredTableWriterPartitioning;
import io.trino.sql.planner.iterative.rule.ApplyTableScanRedirection;
import io.trino.sql.planner.iterative.rule.CanonicalizeExpressions;
import io.trino.sql.planner.iterative.rule.CreatePartialTopN;
Expand All @@ -48,8 +50,6 @@
import io.trino.sql.planner.iterative.rule.DesugarLike;
import io.trino.sql.planner.iterative.rule.DesugarTryExpression;
import io.trino.sql.planner.iterative.rule.DetermineJoinDistributionType;
import io.trino.sql.planner.iterative.rule.DeterminePreferredTableExecutePartitioning;
import io.trino.sql.planner.iterative.rule.DeterminePreferredWritePartitioning;
import io.trino.sql.planner.iterative.rule.DetermineSemiJoinDistributionType;
import io.trino.sql.planner.iterative.rule.DetermineTableScanNodePartitioning;
import io.trino.sql.planner.iterative.rule.EliminateCrossJoins;
Expand Down Expand Up @@ -791,8 +791,8 @@ public PlanOptimizers(
statsCalculator,
estimatedExchangesCostCalculator,
ImmutableSet.of(
new DeterminePreferredWritePartitioning(),
new DeterminePreferredTableExecutePartitioning())),
new ApplyPreferredTableWriterPartitioning(),
new ApplyPreferredTableExecutePartitioning())),
// Because ReorderJoins runs only once,
// PredicatePushDown, columnPruningOptimizer and RemoveRedundantIdentityProjections
// need to run beforehand in order to produce an optimal join order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Replaces {@link TableExecuteNode} with {@link TableExecuteNode#getPreferredPartitioningScheme()}
* with a {@link TableExecuteNode} with {@link TableExecuteNode#getPartitioningScheme()} set.
*/
public class DeterminePreferredTableExecutePartitioning
public class ApplyPreferredTableExecutePartitioning
implements Rule<TableExecuteNode>
{
public static final Pattern<TableExecuteNode> TABLE_EXECUTE_NODE_WITH_PREFERRED_PARTITIONING = tableExecute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* If precondition are met the {@link TableWriterNode} is modified to mark the intention to use preferred write partitioning:
* value of {@link TableWriterNode#getPreferredPartitioningScheme()} is set as result of {@link TableWriterNode#getPartitioningScheme()}.
*/
public class DeterminePreferredWritePartitioning
public class ApplyPreferredTableWriterPartitioning
implements Rule<TableWriterNode>
{
public static final Pattern<TableWriterNode> WRITER_NODE_WITH_PREFERRED_PARTITIONING = tableWriterNode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import static io.trino.testing.TestingSession.testSessionBuilder;
import static java.lang.Double.NaN;

public class TestDeterminePreferredWritePartitioning
public class TestApplyPreferredTableWriterPartitioning
{
private static final String MOCK_CATALOG = "mock_catalog";
private static final String TEST_SCHEMA = "test_schema";
Expand Down Expand Up @@ -163,7 +163,7 @@ public void testThresholdWithMultiplePartitions()

private RuleAssert assertPreferredPartitioning(PartitioningScheme preferredPartitioningScheme)
{
return tester.assertThat(new DeterminePreferredWritePartitioning())
return tester.assertThat(new ApplyPreferredTableWriterPartitioning())
.on(builder -> builder.tableWriter(
ImmutableList.of(),
ImmutableList.of(),
Expand Down

0 comments on commit d10cb87

Please sign in to comment.