private void writeTypeTag(byte typeTag) throws HyracksDataException { try { resultOutput.writeByte(typeTag); } catch (IOException e) { throw HyracksDataException.create(e); } }
public final static int getStartPointCoordinateOffset(Coordinate coordinate) throws HyracksDataException { switch (coordinate) { case X: return 1; case Y: return 9; default: throw new HyracksDataException("Wrong coordinate"); } }
public static HyracksDataException create(HyracksDataException e, String nodeId) { return new HyracksDataException(e.getComponent(), e.getErrorCode(), e.getMessage(), e.getCause(), nodeId, e.getStackTrace(), e.getParams()); } }
public static Throwable getCause(Throwable e, String component, int code) { Throwable current = e; Throwable expected = (current instanceof HyracksDataException && ((HyracksDataException) current).getErrorCode() == code && ((HyracksDataException) current).getComponent().equals(component)) ? current : null; Throwable cause = e.getCause(); while (cause != null && cause != current) { current = cause; expected = (current instanceof HyracksDataException && ((HyracksDataException) current).getErrorCode() == code && ((HyracksDataException) current).getComponent().equals(component)) ? current : expected; cause = current.getCause(); } return expected == null ? current : expected; }
private boolean canRetry(HyracksDataException e) throws HyracksDataException { if (e.getErrorCode() == CANNOT_DROP_IN_USE_INDEX && options.contains(WAIT_ON_IN_USE)) { if (maxWaitTimeMillis <= 0) { return false; } try { TimeUnit.MILLISECONDS.sleep(DROP_ATTEMPT_WAIT_TIME_MILLIS); maxWaitTimeMillis -= DROP_ATTEMPT_WAIT_TIME_MILLIS; return true; } catch (InterruptedException e1) { throw HyracksDataException.create(e1); } } return false; } }
@Test public void returnedMessageWithNoComponentTest() { HyracksDataException cause = new HyracksDataException(ErrorMessageUtil.NONE, ErrorCode.ERROR_PROCESSING_TUPLE, ErrorCode.getErrorMessage(ErrorCode.ERROR_PROCESSING_TUPLE), 2); HyracksDataException causeWithNodeId = HyracksDataException.create(cause, "nc1"); Assert.assertEquals(cause.getMessage(), causeWithNodeId.getMessage()); } }
@Test public void returnedMessageWithComponentTest() { HyracksDataException cause = HyracksDataException.create(ErrorCode.ERROR_PROCESSING_TUPLE, 3); HyracksDataException causeWithNodeId = HyracksDataException.create(cause, "nc1"); Assert.assertEquals(cause.getMessage(), causeWithNodeId.getMessage()); }
private boolean isIgnorable(HyracksDataException e) { return e.getErrorCode() == INDEX_DOES_NOT_EXIST && options.contains(IF_EXISTS); }
private void dropNonExisting(IHyracksTaskContext ctx, IndexDataflowHelperFactory helperFactory) throws Exception { dropFailed.set(false); // Dropping non-existing index IndexDropOperatorNodePushable dropNonExistingOp = new IndexDropOperatorNodePushable(helperFactory, EnumSet.noneOf(DropOption.class), ctx, 0); try { dropNonExistingOp.initialize(); } catch (HyracksDataException e) { e.printStackTrace(); Assert.assertEquals(ErrorCode.INDEX_DOES_NOT_EXIST, e.getErrorCode()); dropFailed.set(true); } Assert.assertTrue(dropFailed.get()); }
bulkLoader.add(tuple); } catch (HyracksDataException e) { if (e.getErrorCode() == ErrorCode.UNSORTED_LOAD_INPUT || e.getErrorCode() == ErrorCode.DUPLICATE_KEY || e.getErrorCode() == ErrorCode.DUPLICATE_LOAD_INPUT) { if (j != i) { fail("Unexpected exception: " + e.getMessage());
@Override public String getMessage() { String message = super.getMessage(); message = message.replaceAll("\\[nodeId\\]", getNodeId()); message = message.replaceAll("\\[path\\]", file.getAbsolutePath()); return message; } }
@Override public void run() { try { writer.nextFrame(buffer); } catch (HyracksDataException e) { e.printStackTrace(); cause = e; } } }
@Override public void dropFeedPolicy(TxnId txnId, String dataverseName, String policyName) throws AlgebricksException, RemoteException { try { ITupleReference searchKey = createTuple(dataverseName, policyName); ITupleReference tuple = getTupleToBeDeleted(txnId, MetadataPrimaryIndexes.FEED_POLICY_DATASET, searchKey); deleteTupleFromIndex(txnId, MetadataPrimaryIndexes.FEED_POLICY_DATASET, tuple); } catch (HyracksDataException e) { if (e.getComponent().equals(ErrorCode.HYRACKS) && e.getErrorCode() == ErrorCode.UPDATE_OR_DELETE_NON_EXISTENT_KEY) { throw new AlgebricksException("Unknown feed policy " + policyName, e); } else { throw new AlgebricksException(e); } } }
@Override public ITupleReference delete(ITupleReference tuple) throws HyracksDataException { try { buddyBTreeBulkLoader.add(tuple); } catch (HyracksDataException e) { //deleting a key multiple times is OK if (e.getErrorCode() != ErrorCode.DUPLICATE_KEY) { cleanupArtifacts(); throw e; } } return tuple; }
private void dropInUse(IHyracksTaskContext ctx, IndexDataflowHelperFactory helperFactory, IIndexDataflowHelper dataflowHelper) throws Exception { dropFailed.set(false); // open the index to make it in-use dataflowHelper.open(); // try to drop in-use index (should fail) IndexDropOperatorNodePushable dropInUseOp = new IndexDropOperatorNodePushable(helperFactory, EnumSet.noneOf(DropOption.class), ctx, 0); try { dropInUseOp.initialize(); } catch (HyracksDataException e) { e.printStackTrace(); Assert.assertEquals(ErrorCode.CANNOT_DROP_IN_USE_INDEX, e.getErrorCode()); dropFailed.set(true); } Assert.assertTrue(dropFailed.get()); }
ResultUtil.printResults(appCtx, resultReader, sessionOutput, new Stats(), null); } catch (HyracksDataException e) { final int errorCode = e.getErrorCode(); if (ErrorCode.NO_RESULT_SET == errorCode) { LOGGER.log(Level.INFO, "No results for: \"" + strHandle + "\""); out.println(e.getMessage()); LOGGER.log(Level.WARN, "Error retrieving result for \"" + strHandle + "\"", e); } catch (Exception e) {
@Override public String getMessage() { StringBuilder msg = new StringBuilder("Parse error"); if (filename != null) { msg.append(" in file ").append(filename); } if (line >= 0) { msg.append(" in line ").append(line); if (column >= 0) { msg.append(", at column ").append(column); } } return msg.append(": ").append(super.getMessage()).toString(); } }
@Override public void reconcile(ITupleReference tuple) throws HyracksDataException { Assert.assertEquals(0, cmp.compare(SearchTask.this.tuple, tuple)); if (blockOnHigh) { try { TupleUtils.createIntegerTuple(builder, SearchTask.this.tuple, expectedAfterBlock); } catch (HyracksDataException e) { e.printStackTrace(); } condition.signal(); condition.awaitUninterruptibly(); blockOnHigh = false; } }
@Override public void init(DataOutput state) throws HyracksDataException { try { state.writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG); state.writeLong(0); } catch (IOException e) { throw HyracksDataException.create(e); } }
/** * Push tuples in the frame forward to the next operator/consumer. * The flushed tuples don't have to be all tuples in the frame. * * @throws HyracksDataException */ public default void flushPartialFrame() throws HyracksDataException { throw new HyracksDataException("flushPartialFrame() is not supported in this ILSMIndexFrameWriter"); } }