@Override public Comparator<double[]> getComparator() { throw new IAE("Comparing arrays of estimates and error bounds is not supported"); }
@Override public Comparator<double[]> getComparator() { throw new IAE("Comparing arrays of p values is not supported"); }
@Override public Comparator<double[]> getComparator() { throw new IAE("Comparing histograms is not supported"); }
public void setSize(int size) { if (size < 0 || size > expansion.length) { throw new IAE("Size[%d] > expansion.length[%d] or < 0", size, expansion.length); } this.size = size; }
public void setSize(int size) { if (size < 0) { throw new IAE("Size[%d] must be non-negative", size); } this.size = size; }
private static String getAvaticaConnectionId(Map<String, Object> requestMap) { Object connectionIdObj = requestMap.get("connectionId"); if (connectionIdObj == null) { throw new IAE("Received an Avatica request without a connectionId."); } if (!(connectionIdObj instanceof String)) { throw new IAE("Received an Avatica request with a non-String connectionId."); } return (String) connectionIdObj; }
public InputRow formatRow(InputRow row) { for (Function<InputRow, InputRow> rowTransformer : rowTransformers) { row = rowTransformer.apply(row); } if (row == null) { throw new IAE("Row is null? How can this be?!"); } return row; }
private static String convertValue(Object dimension, String name) { final String retVal; if (dimension instanceof String) { retVal = (String) dimension; } else if (dimension instanceof Map) { retVal = (String) ((Map) dimension).get(name); } else { throw new IAE("Unknown type[%s] for dimension[%s]", dimension.getClass(), dimension); } return retVal; }
@Override public int get(int index) { if (index < 0 || index >= size) { throw new IAE("Index[%d] >= size[%d] or < 0", index, size); } return base.get(offset + index); }
@Override public void readFully(long pos, ByteBuffer buffer) throws IOException { flush(); if (pos < 0 || pos > ch.size()) { throw new IAE("pos %d out of range [%d, %d]", pos, 0, ch.size()); } ch.read(buffer, pos); if (buffer.remaining() > 0) { throw new BufferUnderflowException(); } }
@Override public List<InputRow> parseBatch(Object input) { if (input instanceof Text) { return ImmutableList.of(parser.parse(((Text) input).toString())); } else if (input instanceof BytesWritable) { BytesWritable valueBytes = (BytesWritable) input; return parser.parseBatch(ByteBuffer.wrap(valueBytes.getBytes(), 0, valueBytes.getLength())); } else { throw new IAE("can't convert type [%s] to InputRow", input.getClass().getName()); } }
@Override public Expr apply(final List<Expr> args) { if (args.size() < 2 || args.size() > 4) { throw new IAE("Function[%s] must have 2 to 4 arguments", name()); } if (args.stream().skip(1).allMatch(Expr::isLiteral)) { return new TimestampFloorExpr(args); } else { return new TimestampFloorDynamicExpr(args); } }
public static Function<String, Interval> makeIntervalExtractor(final String dataSource) { return identifier -> { SegmentId segmentIdentifierParts = tryParse(dataSource, identifier); if (segmentIdentifierParts == null) { throw new IAE("Invalid identifier [%s]", identifier); } return segmentIdentifierParts.getInterval(); }; }
private void checkSize(E e) { if (getBytesSize(e) > capacity) { throw new IAE("cannot add element of size[%d] greater than capacity[%d]", getBytesSize(e), capacity); } }
@Override public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 1) { throw new IAE("Function[%s] needs 1 argument", name()); } Expr expr = args.get(0); return eval(expr.eval(bindings)); }
@Override public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 2) { throw new IAE("Function[%s] needs 2 arguments", name()); } Expr expr1 = args.get(0); Expr expr2 = args.get(1); return eval(expr1.eval(bindings), expr2.eval(bindings)); }
@Override public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 3) { throw new IAE("Function[%s] needs 3 arguments", name()); } ExprEval x = args.get(0).eval(bindings); return x.asBoolean() ? args.get(1).eval(bindings) : args.get(2).eval(bindings); } }
static HllSketch deserializeSketch(final Object object) { if (object instanceof String) { return HllSketch.wrap(Memory.wrap(StringUtils.decodeBase64(((String) object).getBytes(StandardCharsets.UTF_8)))); } else if (object instanceof byte[]) { return HllSketch.wrap(Memory.wrap((byte[]) object)); } else if (object instanceof HllSketch) { return (HllSketch) object; } throw new IAE("Object is not of a type that can be deserialized to an HllSketch:" + object.getClass().getName()); }
@Override public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 1) { throw new IAE("Function[%s] needs 1 argument", name()); } final String arg = args.get(0).eval(bindings).asString(); return arg == null ? ExprEval.ofLong(NullHandling.defaultLongValue()) : ExprEval.of(arg.length()); } }
@Override public QueryRunner<Result<SearchResultValue>> createRunner(Segment adapter) { if (!(adapter instanceof ReferenceCountingSegment)) { throw new IAE("Expected instance of ReferenceCountingSegment, got %s", adapter.getClass()); } final ReferenceCountingSegment segment = (ReferenceCountingSegment) adapter; Assert.assertTrue(segment.getNumReferences() > 0); segmentReferences.add(segment); adapters.add((SegmentForTesting) segment.getBaseSegment()); return new BlockingQueryRunner<>(new NoopQueryRunner<>(), waitLatch, waitYieldLatch, notifyLatch); }