public static ExecutionFailureInfo toFailure(Throwable failure) { return toFailure(failure, newIdentityHashSet()); }
private static void checkMaxSize(long bytes, long count) { checkCondition( bytes <= (MAX_SIZE_IN_BYTES + count) / count, INVALID_FUNCTION_ARGUMENT, "result of repeat function must not take more than 1000000 bytes"); } }
ExecutionFailureInfo cause = toFailure(throwable.getCause(), seenFailures); ErrorCode errorCode = toErrorCode(throwable); if (errorCode == null) { if (cause == null) { cause, Arrays.stream(throwable.getSuppressed()) .map(failure -> toFailure(failure, seenFailures)) .collect(toImmutableList()), Lists.transform(asList(throwable.getStackTrace()), toStringFunction()), getErrorLocation(throwable), errorCode, remoteHost);
public static ExecutionFailureInfo toFailure(Throwable failure) { if (failure == null) { return null; } // todo prevent looping with suppressed cause loops and such String type; if (failure instanceof Failure) { type = ((Failure) failure).getType(); } else { type = failure.getClass().getCanonicalName(); } return new ExecutionFailureInfo(type, failure.getMessage(), toFailure(failure.getCause()), toFailures(asList(failure.getSuppressed())), Lists.transform(asList(failure.getStackTrace()), toStringFunction()), getErrorLocation(failure), toErrorCode(failure)); }
List<ExecutionFailureInfo> failures = ImmutableList.of(); if (state == TaskState.FAILED) { failures = toFailures(taskStateMachine.getFailureCauses());
@Override public boolean positionNotDistinctFromRow(int leftBlockIndex, int leftPosition, int rightPosition, Page page, int[] rightChannels) { if (groupByUsesEqualTo) { return positionEqualsRow(leftBlockIndex, leftPosition, rightPosition, page, rightChannels); } for (int i = 0; i < hashChannels.size(); i++) { int hashChannel = hashChannels.get(i); Block leftBlock = channels.get(hashChannel).get(leftBlockIndex); Block rightBlock = page.getBlock(rightChannels[i]); MethodHandle methodHandle = distinctFromMethodHandles.get(hashChannel); try { if (!(boolean) methodHandle.invokeExact(leftBlock, leftPosition, rightBlock, rightPosition)) { return false; } } catch (Throwable t) { throw internalError(t); } } return true; }
@Nullable private static ErrorCode toErrorCode(@Nullable Throwable throwable) { if (throwable == null) { return null; } if (throwable instanceof PrestoException) { return ((PrestoException) throwable).getErrorCode(); } if (throwable instanceof Failure && ((Failure) throwable).getErrorCode() != null) { return ((Failure) throwable).getErrorCode(); } if (throwable instanceof ParsingException || throwable instanceof SemanticException) { return SYNTAX_ERROR.toErrorCode(); } if (throwable.getCause() != null) { return toErrorCode(throwable.getCause()); } return INTERNAL_ERROR.toErrorCode(); } }
List<ExecutionFailureInfo> failures = ImmutableList.of(); if (state == FAILED) { failures = toFailures(taskStateMachine.getFailureCauses());
throw internalError(t);
public static double verifyAccuracy(double accuracy) { checkCondition(accuracy > 0 && accuracy < 1, INVALID_FUNCTION_ARGUMENT, "Percentile accuracy must be exclusively between 0 and 1, was %s", accuracy); return accuracy; }
@Nullable @JsonProperty public FailureInfo getLastFailureInfo() { Exception lastFailureException = getLastFailureException(); if (lastFailureException == null) { return null; } return Failures.toFailure(lastFailureException).toFailureInfo(); }
List<ExecutionFailureInfo> failures = ImmutableList.of(); if (state == TaskState.FAILED) { failures = toFailures(taskStateMachine.getFailureCauses());
protected static int compare( RowType rowType, List<MethodHandle> comparisonFunctions, Block leftRow, Block rightRow) { for (int i = 0; i < leftRow.getPositionCount(); i++) { checkElementNotNull(leftRow.isNull(i), "null value at position " + i); checkElementNotNull(rightRow.isNull(i), "null value at position " + i); Type type = rowType.getTypeParameters().get(i); Object leftElement = readNativeValue(type, leftRow, i); Object rightElement = readNativeValue(type, rightRow, i); try { if ((boolean) comparisonFunctions.get(i).invoke(leftElement, rightElement)) { return 1; } if ((boolean) comparisonFunctions.get(i).invoke(rightElement, leftElement)) { return -1; } } catch (Throwable t) { throw internalError(t); } } return 0; } }
public static long verifyWeight(long weight) { checkCondition(weight > 0, INVALID_FUNCTION_ARGUMENT, "Percentile weight must be > 0, was %s", weight); return weight; } }
public boolean transitionToFailed(Throwable throwable) { requireNonNull(throwable, "throwable is null"); failureCause.compareAndSet(null, Failures.toFailure(throwable)); boolean failed = stageState.setIf(FAILED, currentState -> !currentState.isDone()); if (failed) { log.error(throwable, "Stage %s failed", stageId); } else { log.debug(throwable, "Failure after stage %s finished", stageId); } return failed; }
@Override public TaskInfo getTaskInfo() { TaskState state = taskStateMachine.getState(); List<ExecutionFailureInfo> failures = ImmutableList.of(); if (state == TaskState.FAILED) { failures = toFailures(taskStateMachine.getFailureCauses()); } return new TaskInfo( taskStateMachine.getTaskId(), TASK_INSTANCE_ID, nextTaskInfoVersion.getAndIncrement(), state, location, DateTime.now(), sharedBuffer.getInfo(), ImmutableSet.<PlanNodeId>of(), taskContext.getTaskStats(), failures, true); }
private static void compareAndUpdateState(MethodHandle methodHandle, NullableLongState state, long value) { if (state.isNull()) { state.setNull(false); state.setLong(value); return; } try { if ((boolean) methodHandle.invokeExact(value, state.getLong())) { state.setLong(value); } } catch (Throwable t) { throw internalError(t); } }
private static void checkRadix(long radix) { checkCondition(radix >= MIN_RADIX && radix <= MAX_RADIX, INVALID_FUNCTION_ARGUMENT, "Radix must be between %d and %d", MIN_RADIX, MAX_RADIX); }
public static QueryInfo immediateFailureQueryInfo(Session session, String query, URI self, Optional<ResourceGroupId> resourceGroupId, Throwable throwable) ExecutionFailureInfo failureCause = toFailure(throwable); QueryInfo queryInfo = new QueryInfo( session.getQueryId(),
private static void compareAndUpdateState(MethodHandle methodHandle, NullableDoubleState state, double value) { if (state.isNull()) { state.setNull(false); state.setDouble(value); return; } try { if ((boolean) methodHandle.invokeExact(value, state.getDouble())) { state.setDouble(value); } } catch (Throwable t) { throw internalError(t); } }