本文整理了Java中org.apache.parquet.io.api.Binary.length()
方法的一些代码示例,展示了Binary.length()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binary.length()
方法的具体详情如下:
包路径:org.apache.parquet.io.api.Binary
类名称:Binary
方法名:length
暂无
代码示例来源: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.lasersonlab.apache.parquet/parquet-column
@Override
int sizeOf(Object value) {
return ((Binary) value).length();
}
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
@Override
public boolean isSmallerThan(long size) {
return !hasNonNullValue() || ((min.length() + max.length()) < size);
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
@Override
public final void writeBytes(Binary v) {
if (v.length() != length) {
throw new IllegalArgumentException("Fixed Binary size " + v.length() +
" does not match field type length " + length);
}
try {
v.writeTo(out);
} catch (IOException e) {
throw new ParquetEncodingException("could not write fixed bytes", e);
}
}
代码示例来源:origin: org.apache.parquet/parquet-column
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: dremio/dremio-oss
@Override
public void addBinary(Binary value) {
final int length = value.length();
final byte[] bytes = value.getBytes();
/* set the bytes in LE format in the buffer of decimal vector, we will swap
* the bytes while writing into the vector.
*/
writer.writeBigEndianBytesToDecimal(bytes);
}
}
代码示例来源:origin: org.apache.parquet/parquet-column
@Override
String stringifyNotNull(Binary value) {
if (value.length() != 12) {
return BINARY_INVALID;
}
ByteBuffer buffer = value.toByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
int pos = buffer.position();
String months = UNSIGNED_STRINGIFIER.stringify(buffer.getInt(pos));
String days = UNSIGNED_STRINGIFIER.stringify(buffer.getInt(pos + 4));
String millis = UNSIGNED_STRINGIFIER.stringify(buffer.getInt(pos + 8));
return "interval(" + months + " months, " + days + " days, " + millis + " millis)";
}
};
代码示例来源:origin: dremio/dremio-oss
@Override
public void addBinary(Binary value) {
holder.buffer = buf = buf.reallocIfNeeded(value.length());
buf.setBytes(0, value.toByteBuffer());
holder.start = 0;
holder.end = value.length();
writer.writeVarChar(holder.start, holder.end, holder.buffer);
}
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
@Override
String stringifyNotNull(Binary value) {
if (value.length() != 12) {
return BINARY_INVALID;
}
ByteBuffer buffer = value.toByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
int pos = buffer.position();
String months = UNSIGNED_STRINGIFIER.stringify(buffer.getInt(pos));
String days = UNSIGNED_STRINGIFIER.stringify(buffer.getInt(pos + 4));
String millis = UNSIGNED_STRINGIFIER.stringify(buffer.getInt(pos + 8));
return "interval(" + months + " months, " + days + " days, " + millis + " millis)";
}
};
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
@Override
public void addBinary(Binary value) {
holder.buffer = buf.reallocIfNeeded(value.length());
holder.buffer.setBytes(0, value.toByteBuffer());
holder.start = 0;
holder.end = value.length();
writer.write(holder);
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
public void writeBytes(Binary v) {
//for rawdata, length(4 bytes int) is stored, followed by the binary content itself
rawDataByteSize += v.length() + 4;
currentWriter.writeBytes(v);
checkFallback();
}
代码示例来源:origin: dremio/dremio-oss
@Override
public void addBinary(Binary value) {
holder.buffer = buf = buf.reallocIfNeeded(value.length());
buf.setBytes(0, value.toByteBuffer());
holder.start = 0;
holder.end = value.length();
writer.writeVarBinary(holder.start, holder.end, holder.buffer);
}
}
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
@Override
public void addBinary(Binary value) {
holder.buffer = buf = buf.reallocIfNeeded(value.length());
buf.setBytes(0, value.toByteBuffer());
holder.start = 0;
holder.end = value.length();
writer.write(holder);
}
}
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
@Override
public void addBinary(Binary value) {
holder.buffer = buf = buf.reallocIfNeeded(value.length());
buf.setBytes(0, value.toByteBuffer());
holder.start = 0;
holder.end = value.length();
writer.write(holder);
}
}
代码示例来源:origin: org.apache.parquet/parquet-column
@Override
public void writeBytes(Binary v) {
try {
lengthWriter.writeInteger(v.length());
v.writeTo(out);
} catch (IOException e) {
throw new ParquetEncodingException("could not write bytes", e);
}
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
@Override
public final void writeBytes(Binary v) {
try {
out.writeInt(v.length());
v.writeTo(out);
} catch (IOException e) {
throw new ParquetEncodingException("could not write bytes", e);
}
}
代码示例来源:origin: dremio/dremio-oss
@Override
public boolean setSafe(int index, ArrowBuf value, int start, int length) {
if (index >= vector.getValueCapacity()) {
return false;
}
if (usingDictionary) {
ByteBuffer buf = currDictValToWrite.toByteBuffer();
vector.setSafe(index, buf, buf.position(), currDictValToWrite.length());
} else {
vector.setSafe(index, 1, start, start + length, value);
}
return true;
}
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
@Override
public boolean setSafe(int index, DrillBuf value, int start, int length) {
if (index >= nullableVarBinaryVector.getValueCapacity()) {
return false;
}
if (usingDictionary) {
ByteBuffer buf = currDictValToWrite.toByteBuffer();
mutator.setSafe(index, buf, buf.position(), currDictValToWrite.length());
} else {
mutator.setSafe(index, 1, start, start + length, value);
}
return true;
}
代码示例来源:origin: org.apache.parquet/parquet-column
@Override
public void writeBytes(Binary v) {
int id = binaryDictionaryContent.getInt(v);
if (id == -1) {
id = binaryDictionaryContent.size();
binaryDictionaryContent.put(v.copy(), id);
// length as int (4 bytes) + actual bytes
dictionaryByteSize += 4 + v.length();
}
encodedValues.add(id);
}
代码示例来源:origin: org.lasersonlab.apache.parquet/parquet-column
@Override
public void writeBytes(Binary v) {
int id = binaryDictionaryContent.getInt(v);
if (id == -1) {
id = binaryDictionaryContent.size();
binaryDictionaryContent.put(v.copy(), id);
// length as int (4 bytes) + actual bytes
dictionaryByteSize += 4 + v.length();
}
encodedValues.add(id);
}
内容来源于网络,如有侵权,请联系作者删除!