parquet.io.api.Binary.toByteBuffer()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(116)

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

Binary.toByteBuffer介绍

暂无

代码示例

代码示例来源:origin: asakusafw/asakusafw

@Override
public void addBinary(Binary value) {
  ByteBuffer bytes = value.toByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
  long time = bytes.getLong();
  int day = bytes.getInt();
  addNanoTime(day, time);
}

代码示例来源:origin: com.twitter/parquet-tools

public static String binaryToString(Binary value) {
  byte[] data = value.getBytes();
  if (data == null) return null;
  try {
    CharBuffer buffer = UTF8_DECODER.decode(value.toByteBuffer());
    return buffer.toString();
  } catch (Throwable th) {
  }
  return "<bytes...>";
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

public static NanoTime fromInt96(Int96Value int96) {
 ByteBuffer buf = int96.getInt96().toByteBuffer();
 return new NanoTime(buf.getInt(), buf.getLong());
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

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: com.facebook.presto.hive/hive-apache

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: asakusafw/asakusafw

@Override
public void setDictionary(Dictionary dictionary) {
  int size = dictionary.getMaxId() + 1;
  if (this.julianDays == null || this.julianDays.length < size) {
    int capacity = (int) (size * 1.2) + 1;
    this.julianDays = new int[capacity];
    this.nanoTimes = new long[capacity];
  }
  for (int id = 0, max = dictionary.getMaxId(); id <= max; id++) {
    ByteBuffer bytes = dictionary.decodeToBinary(id).toByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
    long time = bytes.getLong();
    int day = bytes.getInt();
    julianDays[id] = day;
    nanoTimes[id] = time;
  }
}

相关文章