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

Revert "Ensure PartitionedOutputOperator is run with fixed local distribution" #15358

Merged
merged 1 commit into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ public final class SystemSessionProperties
public static final String USE_EXACT_PARTITIONING = "use_exact_partitioning";
public static final String FORCE_SPILLING_JOIN = "force_spilling_join";
public static final String FAULT_TOLERANT_EXECUTION_EVENT_DRIVEN_SCHEDULER_ENABLED = "fault_tolerant_execution_event_driven_scheduler_enabled";
public static final String FORCE_FIXED_DISTRIBUTION_FOR_PARTITIONED_OUTPUT_OPERATOR_ENABLED = "force_fixed_distribution_for_partitioned_output_operator_enabled";
public static final String FAULT_TOLERANT_EXECUTION_FORCE_PREFERRED_WRITE_PARTITIONING_ENABLED = "fault_tolerant_execution_force_preferred_write_partitioning_enabled";

private final List<PropertyMetadata<?>> sessionProperties;
Expand Down Expand Up @@ -879,11 +878,6 @@ public SystemSessionProperties(
"Enable event driven scheduler for fault tolerant execution",
queryManagerConfig.isFaultTolerantExecutionEventDrivenSchedulerEnabled(),
true),
booleanProperty(
FORCE_FIXED_DISTRIBUTION_FOR_PARTITIONED_OUTPUT_OPERATOR_ENABLED,
"Force partitioned output operator to be run with fixed distribution",
optimizerConfig.isForceFixedDistributionForPartitionedOutputOperatorEnabled(),
true),
booleanProperty(
FAULT_TOLERANT_EXECUTION_FORCE_PREFERRED_WRITE_PARTITIONING_ENABLED,
"Force preferred write partitioning for fault tolerant execution",
Expand Down Expand Up @@ -1572,11 +1566,6 @@ public static boolean isFaultTolerantExecutionEventDriverSchedulerEnabled(Sessio
return session.getSystemProperty(FAULT_TOLERANT_EXECUTION_EVENT_DRIVEN_SCHEDULER_ENABLED, Boolean.class);
}

public static boolean isForceFixedDistributionForPartitionedOutputOperatorEnabled(Session session)
{
return session.getSystemProperty(FORCE_FIXED_DISTRIBUTION_FOR_PARTITIONED_OUTPUT_OPERATOR_ENABLED, Boolean.class);
}

public static boolean isFaultTolerantExecutionForcePreferredWritePartitioningEnabled(Session session)
{
if (!isFaultTolerantExecutionEventDriverSchedulerEnabled(session)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ public class OptimizerConfig
private double adaptivePartialAggregationUniqueRowsRatioThreshold = 0.8;
private long joinPartitionedBuildMinRowCount = 1_000_000L;

private boolean forceFixedDistributionForPartitionedOutputOperatorEnabled = true;

public enum JoinReorderingStrategy
{
NONE,
Expand Down Expand Up @@ -758,16 +756,4 @@ public OptimizerConfig setUseExactPartitioning(boolean useExactPartitioning)
this.useExactPartitioning = useExactPartitioning;
return this;
}

public boolean isForceFixedDistributionForPartitionedOutputOperatorEnabled()
{
return forceFixedDistributionForPartitionedOutputOperatorEnabled;
}

@Config("experimental.force-fixed-distribution-for-partitioned-output-operator-enabled")
public OptimizerConfig setForceFixedDistributionForPartitionedOutputOperatorEnabled(boolean forceFixedDistributionForPartitionedOutputOperatorEnabled)
{
this.forceFixedDistributionForPartitionedOutputOperatorEnabled = forceFixedDistributionForPartitionedOutputOperatorEnabled;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,33 +104,25 @@ public class AddExchangesBelowPartialAggregationOverGroupIdRuleSet
typeOf(ExchangeNode.class)
.with(scope().equalTo(REMOTE))
.with(source().matching(
typeOf(ProjectNode.class)
// PushPartialAggregationThroughExchange adds a projection. However, it can be removed if RemoveRedundantIdentityProjections is run in the mean-time.
typeOf(ProjectNode.class).capturedAs(PROJECTION)
.with(source().matching(
typeOf(ExchangeNode.class)
.with(scope().equalTo(LOCAL))
typeOf(AggregationNode.class).capturedAs(AGGREGATION)
.with(step().equalTo(AggregationNode.Step.PARTIAL))
.with(nonEmpty(groupingColumns()))
.with(source().matching(
// PushPartialAggregationThroughExchange adds a projection. However, it can be removed if RemoveRedundantIdentityProjections is run in the mean-time.
typeOf(ProjectNode.class).capturedAs(PROJECTION)
.with(source().matching(
typeOf(AggregationNode.class).capturedAs(AGGREGATION)
.with(step().equalTo(AggregationNode.Step.PARTIAL))
.with(nonEmpty(groupingColumns()))
.with(source().matching(
typeOf(GroupIdNode.class).capturedAs(GROUP_ID)))))))))));
typeOf(GroupIdNode.class).capturedAs(GROUP_ID)))))));

private static final Pattern<ExchangeNode> WITHOUT_PROJECTION =
// If there was no exchange here, adding new exchanges could break property derivations logic of AddExchanges, AddLocalExchanges
typeOf(ExchangeNode.class)
.with(scope().equalTo(REMOTE))
.with(source().matching(
typeOf(ExchangeNode.class)
.with(scope().equalTo(LOCAL))
typeOf(AggregationNode.class).capturedAs(AGGREGATION)
.with(step().equalTo(AggregationNode.Step.PARTIAL))
.with(nonEmpty(groupingColumns()))
.with(source().matching(
typeOf(AggregationNode.class).capturedAs(AGGREGATION)
.with(step().equalTo(AggregationNode.Step.PARTIAL))
.with(nonEmpty(groupingColumns()))
.with(source().matching(
typeOf(GroupIdNode.class).capturedAs(GROUP_ID)))))));
typeOf(GroupIdNode.class).capturedAs(GROUP_ID)))));

private static final double GROUPING_SETS_SYMBOL_REQUIRED_FREQUENCY = 0.5;
private static final double ANTI_SKEWNESS_MARGIN = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
import static io.trino.SystemSessionProperties.getTaskPartitionedWriterCount;
import static io.trino.SystemSessionProperties.getTaskWriterCount;
import static io.trino.SystemSessionProperties.isDistributedSortEnabled;
import static io.trino.SystemSessionProperties.isForceFixedDistributionForPartitionedOutputOperatorEnabled;
import static io.trino.SystemSessionProperties.isSpillEnabled;
import static io.trino.SystemSessionProperties.isTaskScaleWritersEnabled;
import static io.trino.sql.ExpressionUtils.isEffectivelyLiteral;
Expand Down Expand Up @@ -744,9 +743,6 @@ public PlanWithProperties visitExchange(ExchangeNode node, StreamPreferredProper
any().withOrderSensitivity(),
any().withOrderSensitivity());
}
if (isForceFixedDistributionForPartitionedOutputOperatorEnabled(session) && node.isHashPartitionedExchange()) {
return planAndEnforceChildren(node, fixedParallelism(), defaultParallelism(session));
}
return planAndEnforceChildren(node, any(), defaultParallelism(session));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import static io.trino.sql.planner.SystemPartitioningHandle.FIXED_BROADCAST_DISTRIBUTION;
import static io.trino.sql.planner.SystemPartitioningHandle.FIXED_HASH_DISTRIBUTION;
import static io.trino.sql.planner.SystemPartitioningHandle.FIXED_PASSTHROUGH_DISTRIBUTION;
import static io.trino.sql.planner.SystemPartitioningHandle.SCALED_WRITER_HASH_DISTRIBUTION;
import static io.trino.sql.planner.SystemPartitioningHandle.SINGLE_DISTRIBUTION;
import static io.trino.sql.planner.plan.ExchangeNode.Scope.LOCAL;
import static io.trino.sql.planner.plan.ExchangeNode.Scope.REMOTE;
Expand Down Expand Up @@ -251,11 +250,4 @@ public PlanNode replaceChildren(List<PlanNode> newChildren)
{
return new ExchangeNode(getId(), type, scope, partitioningScheme, newChildren, inputs, orderingScheme);
}

public boolean isHashPartitionedExchange()
{
PartitioningHandle partitioningHandle = partitioningScheme.getPartitioning().getHandle();
// catalog specific exchanges are hash partitioned exchanges with a catalog specific partition function
return partitioningHandle.equals(FIXED_HASH_DISTRIBUTION) || partitioningHandle.equals(SCALED_WRITER_HASH_DISTRIBUTION) || partitioningHandle.getCatalogHandle().isPresent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ public void testDefaults()
.setAdaptivePartialAggregationMinRows(100_000)
.setAdaptivePartialAggregationUniqueRowsRatioThreshold(0.8)
.setJoinPartitionedBuildMinRowCount(1_000_000)
.setUseExactPartitioning(false)
.setForceFixedDistributionForPartitionedOutputOperatorEnabled(true));
.setUseExactPartitioning(false));
}

@Test
Expand Down Expand Up @@ -148,7 +147,6 @@ public void testExplicitPropertyMappings()
.put("adaptive-partial-aggregation.unique-rows-ratio-threshold", "0.99")
.put("optimizer.join-partitioned-build-min-row-count", "1")
.put("optimizer.use-exact-partitioning", "true")
.put("experimental.force-fixed-distribution-for-partitioned-output-operator-enabled", "false")
.buildOrThrow();

OptimizerConfig expected = new OptimizerConfig()
Expand Down Expand Up @@ -202,8 +200,7 @@ public void testExplicitPropertyMappings()
.setAdaptivePartialAggregationMinRows(1)
.setAdaptivePartialAggregationUniqueRowsRatioThreshold(0.99)
.setJoinPartitionedBuildMinRowCount(1)
.setUseExactPartitioning(true)
.setForceFixedDistributionForPartitionedOutputOperatorEnabled(false);
.setUseExactPartitioning(true);
assertFullMapping(properties, expected);
}
}
Loading