本文整理汇总了Java中parquet.io.api.Binary.length方法的典型用法代码示例。如果您正苦于以下问题:Java Binary.length方法的具体用法?Java Binary.length怎么用?Java Binary.length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parquet.io.api.Binary
的用法示例。
在下文中一共展示了Binary.length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBinary
import parquet.io.api.Binary; //导入方法依赖的package包/类
@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);
}
示例2: readValues
import parquet.io.api.Binary; //导入方法依赖的package包/类
@Override
public void readValues(ValuesReader valuesReader, int valueNumber, ParquetLevelReader definitionReader)
{
for (int i = 0; i < valueNumber; i++) {
if (definitionReader.readLevel() == descriptor.getMaxDefinitionLevel()) {
Binary binary = valuesReader.readBytes();
if (binary.length() != 0) {
VARCHAR.writeSlice(blockBuilder, Slices.wrappedBuffer(binary.getBytes()));
continue;
}
}
blockBuilder.appendNull();
}
}
示例3: getTimestampMillis
import parquet.io.api.Binary; //导入方法依赖的package包/类
/**
* Returns GMT timestamp from binary encoded parquet timestamp (12 bytes - julian date + time of day nanos).
*
* @param timestampBinary INT96 parquet timestamp
* @return timestamp in millis, GMT timezone
*/
public static long getTimestampMillis(Binary timestampBinary)
{
if (timestampBinary.length() != 12) {
throw new PrestoException(HIVE_BAD_DATA, "Parquet timestamp must be 12 bytes, actual " + timestampBinary.length());
}
byte[] bytes = timestampBinary.getBytes();
// little endian encoding - need to invert byte order
long timeOfDayNanos = Longs.fromBytes(bytes[7], bytes[6], bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0]);
int julianDay = Ints.fromBytes(bytes[11], bytes[10], bytes[9], bytes[8]);
return julianDayToMillis(julianDay) + (timeOfDayNanos / NANOS_PER_MILLISECOND);
}