本文整理了Java中org.apache.parquet.io.api.Binary.fromReusedByteArray()
方法的一些代码示例,展示了Binary.fromReusedByteArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binary.fromReusedByteArray()
方法的具体详情如下:
包路径:org.apache.parquet.io.api.Binary
类名称:Binary
方法名:fromReusedByteArray
暂无
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
@Deprecated
/**
* @deprecated Use @link{fromReusedByteArray} or @link{fromConstantByteArray} instead
*/
public static Binary fromByteArray(final byte[] value) {
return fromReusedByteArray(value); // Assume producer intends to reuse byte[]
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
@Deprecated
/**
* @deprecated Use @link{fromReusedByteArray} or @link{fromConstantByteArray} instead
*/
public static Binary fromByteArray(final byte[] value, final int offset, final int length) {
return fromReusedByteArray(value, offset, length); // Assume producer intends to reuse byte[]
}
代码示例来源:origin: org.apache.parquet/parquet-column
@Deprecated
/**
* @deprecated Use @link{fromReusedByteArray} or @link{fromConstantByteArray} instead
*/
public static Binary fromByteArray(final byte[] value, final int offset, final int length) {
return fromReusedByteArray(value, offset, length); // Assume producer intends to reuse byte[]
}
代码示例来源:origin: org.apache.parquet/parquet-column
@Deprecated
/**
* @deprecated Use @link{fromReusedByteArray} or @link{fromConstantByteArray} instead
*/
public static Binary fromByteArray(final byte[] value) {
return fromReusedByteArray(value); // Assume producer intends to reuse byte[]
}
代码示例来源:origin: org.apache.parquet/parquet-column
/**
* Sets min and max values, re-uses the byte[] passed in.
* Any changes made to byte[] will be reflected in min and max values as well.
* @param minBytes byte array to set the min value to
* @param maxBytes byte array to set the max value to
*/
@Override
public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
max = Binary.fromReusedByteArray(maxBytes);
min = Binary.fromReusedByteArray(minBytes);
this.markAsNotEmpty();
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
/**
* Sets min and max values, re-uses the byte[] passed in.
* Any changes made to byte[] will be reflected in min and max values as well.
* @param minBytes byte array to set the min value to
* @param maxBytes byte array to set the max value to
*/
@Override
public void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes) {
max = Binary.fromReusedByteArray(maxBytes);
min = Binary.fromReusedByteArray(minBytes);
this.markAsNotEmpty();
}
代码示例来源:origin: Netflix/iceberg
@Override
public void write(int repetitionLevel, byte[] value) {
column.writeBinary(repetitionLevel, Binary.fromReusedByteArray(value));
}
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
@Override
public Binary slice(int start, int length) {
if (isBackingBytesReused) {
return Binary.fromReusedByteArray(value, offset + start, length);
} else {
return Binary.fromConstantByteArray(value, offset + start, length);
}
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
@Override
public Binary slice(int start, int length) {
if (isBackingBytesReused) {
return Binary.fromReusedByteArray(value, start, length);
} else {
return Binary.fromConstantByteArray(value, start, length);
}
}
代码示例来源:origin: org.apache.parquet/parquet-column
@Override
public Binary slice(int start, int length) {
if (isBackingBytesReused) {
return Binary.fromReusedByteArray(value, offset + start, length);
} else {
return Binary.fromConstantByteArray(value, offset + start, length);
}
}
代码示例来源:origin: org.apache.parquet/parquet-column
@Override
public Binary slice(int start, int length) {
if (isBackingBytesReused) {
return Binary.fromReusedByteArray(value, start, length);
} else {
return Binary.fromConstantByteArray(value, start, length);
}
}
代码示例来源:origin: org.apache.parquet/parquet-thrift
private void writeBinaryToRecordConsumer(ByteBuffer buf) {
recordConsumer.addBinary(Binary.fromReusedByteArray(buf.array(), buf.position(),
buf.limit() - buf.position()));
}
代码示例来源:origin: Netflix/iceberg
@Override
public void write(int repetitionLevel, BigDecimal decimal) {
Preconditions.checkArgument(decimal.scale() == scale,
"Cannot write value as decimal(%s,%s), wrong scale: %s", precision, scale, decimal);
Preconditions.checkArgument(decimal.precision() <= precision,
"Cannot write value as decimal(%s,%s), too large: %s", precision, scale, decimal);
byte fillByte = (byte) (decimal.signum() < 0 ? 0xFF : 0x00);
byte[] unscaled = decimal.unscaledValue().toByteArray();
byte[] buf = bytes.get();
int offset = length - unscaled.length;
for (int i = 0; i < length; i += 1) {
if (i < offset) {
buf[i] = fillByte;
} else {
buf[i] = unscaled[i - offset];
}
}
column.writeBinary(repetitionLevel, Binary.fromReusedByteArray(buf));
}
}
代码示例来源:origin: Netflix/iceberg
@Override
public void write(int repetitionLevel, Fixed buffer) {
column.writeBinary(repetitionLevel, Binary.fromReusedByteArray(buffer.bytes()));
}
}
代码示例来源:origin: org.apache.carbondata/carbondata-spark-datasource
CarbonDictionaryWrapper(Encoding encoding, CarbonDictionary dictionary) {
super(encoding);
binaries = new Binary[dictionary.getDictionarySize()];
for (int i = 0; i < binaries.length; i++) {
binaries[i] = Binary.fromReusedByteArray(dictionary.getDictionaryValue(i));
}
}
代码示例来源:origin: org.apache.parquet/parquet-avro
private Binary fromAvroString(Object value) {
if (value instanceof Utf8) {
Utf8 utf8 = (Utf8) value;
return Binary.fromReusedByteArray(utf8.getBytes(), 0, utf8.getByteLength());
}
return Binary.fromCharSequence((CharSequence) value);
}
代码示例来源:origin: com.alibaba.blink/flink-table
@Override
public void write(BaseRow row, int ordinal) {
recordConsumer.addBinary(
Binary.fromReusedByteArray(row.getBinaryString(ordinal).getBytes()));
}
}
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
@Override
public void writeValue(RecordConsumer consumer, DrillBuf buffer, int start, int end, int precision) {
int typeLength = DecimalUtility.getMaxBytesSizeForPrecision(precision);
int length = end - start;
int startPos = typeLength - length;
byte[] output = new byte[typeLength];
if (startPos >= 0) {
buffer.getBytes(start, output, startPos, length);
if (output[startPos] < 0) {
Arrays.fill(output, 0, output.length - length, (byte) -1);
}
} else {
// in this case value from FIXED_LEN_BYTE_ARRAY or BINARY field with greater length was taken, ignore leading bytes
buffer.getBytes(start - startPos, output, 0, length + startPos);
}
consumer.addBinary(Binary.fromReusedByteArray(output));
}
}
代码示例来源:origin: Netflix/iceberg
@Override
public void write(int repetitionLevel, CharSequence value) {
if (value instanceof Utf8) {
Utf8 utf8 = (Utf8) value;
column.writeBinary(repetitionLevel,
Binary.fromReusedByteArray(utf8.getBytes(), 0, utf8.getByteLength()));
} else {
column.writeBinary(repetitionLevel, Binary.fromString(value.toString()));
}
}
}
代码示例来源:origin: uk.gov.gchq.gaffer/parquet-store
private void writePrimitive(final Object object) throws SerialisationException {
if (object instanceof String) {
recordConsumer.addBinary(Binary.fromString((String) object));
} else if (object instanceof byte[]) {
recordConsumer.addBinary(Binary.fromReusedByteArray((byte[]) object));
} else if (object instanceof Long) {
recordConsumer.addLong((long) object);
} else if (object instanceof Integer) {
recordConsumer.addInteger((int) object);
} else if (object instanceof Float) {
recordConsumer.addFloat((float) object);
} else if (object instanceof Double) {
recordConsumer.addDouble((double) object);
} else if (object instanceof Boolean) {
recordConsumer.addBoolean((boolean) object);
} else {
throw new SerialisationException(object.getClass().getCanonicalName() + " is not a supported primitive type");
}
}
}
内容来源于网络,如有侵权,请联系作者删除!