Use NO_NODES_AVAILABLE Exception for affinity scheduler
@@ -17,6 +17,7 @@ import com.facebook.presto.hive.metastore.Column;
import com.facebook.presto.hive.metastore.Storage;
import com.facebook.presto.spi.ConnectorSplit;
import com.facebook.presto.spi.HostAddress;
+import com.facebook.presto.spi.PrestoException;
import com.facebook.presto.spi.schedule.NodeSelectionStrategy;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -29,6 +30,7 @@ import java.util.Objects;
import java.util.Optional;
import java.util.OptionalInt;
+import static com.facebook.presto.spi.StandardErrorCode.NO_NODES_AVAILABLE;
import static com.facebook.presto.spi.schedule.NodeSelectionStrategy.SOFT_AFFINITY;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
@@ -178,7 +180,7 @@ public class HiveSplit
public List<HostAddress> getPreferredNodes(List<HostAddress> sortedCandidates)
{
if (sortedCandidates == null || sortedCandidates.isEmpty()) {
- throw new RuntimeException("sortedCandidates is null or empty for HiveSplit");
+ throw new PrestoException(NO_NODES_AVAILABLE, "sortedCandidates is null or empty for HiveSplit");
}
if (getNodeSelectionStrategy() == SOFT_AFFINITY) {
