org.apache.parquet.Preconditions.checkArgument()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.apache.parquet.Preconditions.checkArgument()方法的一些代码示例,展示了Preconditions.checkArgument()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Preconditions.checkArgument()方法的具体详情如下:
包路径:org.apache.parquet.Preconditions
类名称:Preconditions
方法名:checkArgument

Preconditions.checkArgument介绍

[英]Precondition-style validation that throws IllegalArgumentException.
[中]引发IllegalArgumentException的前置条件样式验证。

代码示例

代码示例来源:origin: apache/hive

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);
}

代码示例来源:origin: org.apache.spark/spark-sql_2.10

/**
 * 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);
}

代码示例来源:origin: org.apache.spark/spark-sql_2.11

/**
 * 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);
}

代码示例来源:origin: org.apache.spark/spark-sql

/**
 * 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);
}

代码示例来源:origin: org.apache.parquet/parquet-avro

@Override
 public void add(Object value) {
  Preconditions.checkArgument(
    AvroUnionConverter.this.memberValue == null,
    "Union is resolving to more than one type");
  memberValue = value;
 }
});

代码示例来源:origin: org.apache.parquet/parquet-avro

@Override
 public void add(Object value) {
  Preconditions.checkArgument(memberValue==null, "Union is resolving to more than one type");
  memberValue = value;
 }
});

代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-common

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;
}

代码示例来源:origin: apache/tajo

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;
}

代码示例来源:origin: org.apache.parquet/parquet-hadoop

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;
}

代码示例来源:origin: org.apache.parquet/parquet-column

/**
 * 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;
}

代码示例来源:origin: org.apache.parquet/parquet-common

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;
}

代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column

/**
 * 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;
}

代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column

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);
}

代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-common

@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);
}

代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-hadoop

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);
 }
}

代码示例来源:origin: org.apache.parquet/parquet-hadoop

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);
 }
}

代码示例来源:origin: io.snappydata/snappy-spark-sql

/**
 * 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);
}

代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column

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();
}

代码示例来源:origin: org.apache.parquet/parquet-column

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);
}

代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column

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;
}

相关文章