Skip to content

Commit

Permalink
Fail the merge join query if grouped execution can't be enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kewang1024 authored and highker committed Jun 21, 2022
1 parent 48266ed commit d5ba813
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import static com.facebook.presto.SystemSessionProperties.GROUPED_EXECUTION;
import static com.facebook.presto.SystemSessionProperties.getExchangeMaterializationStrategy;
import static com.facebook.presto.SystemSessionProperties.getQueryMaxStageCount;
import static com.facebook.presto.SystemSessionProperties.getTaskPartitionedWriterCount;
Expand All @@ -104,6 +105,7 @@
import static com.facebook.presto.SystemSessionProperties.isTableWriterMergeOperatorEnabled;
import static com.facebook.presto.common.type.BigintType.BIGINT;
import static com.facebook.presto.common.type.VarbinaryType.VARBINARY;
import static com.facebook.presto.spi.StandardErrorCode.INVALID_PLAN_ERROR;
import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED;
import static com.facebook.presto.spi.StandardErrorCode.QUERY_HAS_TOO_MANY_STAGES;
import static com.facebook.presto.spi.StandardWarningCode.TOO_MANY_STAGES;
Expand Down Expand Up @@ -1101,7 +1103,15 @@ public GroupedExecutionProperties visitMergeJoin(MergeJoinNode node, Void contex
left.totalLifespans,
left.recoveryEligible && right.recoveryEligible);
}
return GroupedExecutionProperties.notCapable();
throw new PrestoException(
INVALID_PLAN_ERROR,
format("When grouped execution can't be enabled, merge join plan is not valid." +
"%s is currently set to %s; left node grouped execution capable is %s and " +
"right node grouped execution capable is %s.",
GROUPED_EXECUTION,
groupedExecutionEnabled,
left.currentNodeCapable,
right.currentNodeCapable));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public enum StandardErrorCode
RETRY_QUERY_NOT_FOUND(0x0001_0021, INTERNAL_ERROR),
DISTRIBUTED_TRACING_ERROR(0x0001_0022, INTERNAL_ERROR),
GENERIC_SPILL_FAILURE(0x0001_0023, INTERNAL_ERROR),
INVALID_PLAN_ERROR(0x0001_0024, INTERNAL_ERROR),

GENERIC_INSUFFICIENT_RESOURCES(0x0002_0000, INSUFFICIENT_RESOURCES),
EXCEEDED_GLOBAL_MEMORY_LIMIT(0x0002_0001, INSUFFICIENT_RESOURCES),
Expand Down

0 comments on commit d5ba813

Please sign in to comment.