public static NanoTime fromBinary(Binary bytes) { Preconditions.checkArgument(bytes.length() == 12, "Must be 12 bytes"); ByteBuffer buf = bytes.toByteBuffer(); buf.order(ByteOrder.LITTLE_ENDIAN); long timeOfDayNanos = buf.getLong(); int julianDay = buf.getInt(); return new NanoTime(julianDay, timeOfDayNanos); }
/** * Initializes the internal state for decoding ints of `bitWidth`. */ private void init(int bitWidth) { Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth); this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); }
/** * Initializes the internal state for decoding ints of `bitWidth`. */ private void init(int bitWidth) { Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth); this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); }
/** * Initializes the internal state for decoding ints of `bitWidth`. */ private void init(int bitWidth) { Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth); this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); }
@Override public void add(Object value) { Preconditions.checkArgument( AvroUnionConverter.this.memberValue == null, "Union is resolving to more than one type"); memberValue = value; } });
@Override public void add(Object value) { Preconditions.checkArgument(memberValue==null, "Union is resolving to more than one type"); memberValue = value; } });
public SemanticVersion(int major, int minor, int patch, boolean hasUnknown) { Preconditions.checkArgument(major >= 0, "major must be >= 0"); Preconditions.checkArgument(minor >= 0, "minor must be >= 0"); Preconditions.checkArgument(patch >= 0, "patch must be >= 0"); this.major = major; this.minor = minor; this.patch = patch; this.prerelease = hasUnknown; this.unknown = null; this.pre = null; this.buildInfo = null; }
protected ReadSupport<T> getReadSupport() { // if readSupport is null, the protected constructor must have been used Preconditions.checkArgument(readSupport != null, "[BUG] Classes that extend Builder should override getReadSupport()"); return readSupport; }
protected ReadSupport<T> getReadSupport() { // if readSupport is null, the protected constructor must have been used Preconditions.checkArgument(readSupport != null, "[BUG] Classes that extend Builder should override getReadSupport()"); return readSupport; }
/** * Set the Parquet format dictionary page size. * * @param dictionaryPageSize an integer size in bytes * @return this builder for method chaining. */ public Builder withDictionaryPageSize(int dictionaryPageSize) { Preconditions.checkArgument(dictionaryPageSize > 0, "Invalid dictionary page size (negative): %s", dictionaryPageSize); this.dictPageSize = dictionaryPageSize; return this; }
public SemanticVersion(int major, int minor, int patch, boolean hasUnknown) { Preconditions.checkArgument(major >= 0, "major must be >= 0"); Preconditions.checkArgument(minor >= 0, "minor must be >= 0"); Preconditions.checkArgument(patch >= 0, "patch must be >= 0"); this.major = major; this.minor = minor; this.patch = patch; this.prerelease = hasUnknown; this.unknown = null; this.pre = null; this.buildInfo = null; }
/** * Set the Parquet format page size. * * @param pageSize an integer size in bytes * @return this builder for method chaining. */ public Builder withPageSize(int pageSize) { Preconditions.checkArgument(pageSize > 0, "Invalid page size (negative): %s", pageSize); this.pageSize = pageSize; return this; }
public static IntLogicalTypeAnnotation intType(final int bitWidth, final boolean isSigned) { Preconditions.checkArgument( bitWidth == 8 || bitWidth == 16 || bitWidth == 32 || bitWidth == 64, "Invalid bit width for integer logical type, " + bitWidth + " is not allowed, " + "valid bit width values: 8, 16, 32, 64"); return new IntLogicalTypeAnnotation(bitWidth, isSigned); }
@Override @SuppressWarnings("unchecked") public <R> R invokeChecked(Object target, Object... args) throws Exception { Preconditions.checkArgument(target == null, "Invalid call to constructor: target must be null"); return (R) newInstanceChecked(args); }
public static void setFilterPredicate(Configuration configuration, FilterPredicate filterPredicate) { checkArgument(getUnboundRecordFilter(configuration) == null, "You cannot provide a FilterPredicate after providing an UnboundRecordFilter"); configuration.set(FILTER_PREDICATE + ".human.readable", filterPredicate.toString()); try { SerializationUtil.writeObjectToConfAsBase64(FILTER_PREDICATE, filterPredicate, configuration); } catch (IOException e) { throw new RuntimeException(e); } }
public static void setFilterPredicate(Configuration configuration, FilterPredicate filterPredicate) { checkArgument(getUnboundRecordFilter(configuration) == null, "You cannot provide a FilterPredicate after providing an UnboundRecordFilter"); configuration.set(FILTER_PREDICATE + ".human.readable", filterPredicate.toString()); try { SerializationUtil.writeObjectToConfAsBase64(FILTER_PREDICATE, filterPredicate, configuration); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Initializes the internal state for decoding ints of `bitWidth`. */ private void init(int bitWidth) { Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth); this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); }
protected final THIS repetition(Type.Repetition repetition) { Preconditions.checkArgument(!repetitionAlreadySet, "Repetition has already been set"); Preconditions.checkNotNull(repetition, "Repetition cannot be null"); this.repetition = repetition; this.repetitionAlreadySet = true; return self(); }
public RunLengthBitPackingHybridEncoder(int bitWidth, int initialCapacity, int pageSize, ByteBufferAllocator allocator) { LOG.debug("Encoding: RunLengthBitPackingHybridEncoder with " + "bithWidth: {} initialCapacity {}", bitWidth, initialCapacity); Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.baos = new CapacityByteArrayOutputStream(initialCapacity, pageSize, allocator); this.packBuffer = new byte[bitWidth]; this.bufferedValues = new int[8]; this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); reset(false); }
private ColumnOrder requireValidColumnOrder(ColumnOrder columnOrder) { if (primitive == PrimitiveTypeName.INT96) { Preconditions.checkArgument(columnOrder.getColumnOrderName() == ColumnOrderName.UNDEFINED, "The column order {} is not supported by INT96", columnOrder); } if (getLogicalTypeAnnotation() != null) { Preconditions.checkArgument(getLogicalTypeAnnotation().isValidColumnOrder(columnOrder), "The column order {} is not supported by {} ({})", columnOrder, primitive, getLogicalTypeAnnotation()); } return columnOrder; }