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

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

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

Binary.toByteBuffer介绍

暂无

代码示例

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

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

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

  1. public static String binaryToString(Binary value) {
  2. byte[] data = value.getBytes();
  3. if (data == null) return null;
  4. try {
  5. CharBuffer buffer = UTF8_DECODER.decode(value.toByteBuffer());
  6. return buffer.toString();
  7. } catch (Throwable th) {
  8. }
  9. return "<bytes...>";
  10. }

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

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

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

  1. public static NanoTime fromBinary(Binary bytes) {
  2. Preconditions.checkArgument(bytes.length() == 12, "Must be 12 bytes");
  3. ByteBuffer buf = bytes.toByteBuffer();
  4. buf.order(ByteOrder.LITTLE_ENDIAN);
  5. long timeOfDayNanos = buf.getLong();
  6. int julianDay = buf.getInt();
  7. return new NanoTime(julianDay, timeOfDayNanos);
  8. }

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

  1. public static NanoTime fromBinary(Binary bytes) {
  2. Preconditions.checkArgument(bytes.length() == 12, "Must be 12 bytes");
  3. ByteBuffer buf = bytes.toByteBuffer();
  4. buf.order(ByteOrder.LITTLE_ENDIAN);
  5. long timeOfDayNanos = buf.getLong();
  6. int julianDay = buf.getInt();
  7. return new NanoTime(julianDay, timeOfDayNanos);
  8. }

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

  1. @Override
  2. public void setDictionary(Dictionary dictionary) {
  3. int size = dictionary.getMaxId() + 1;
  4. if (this.julianDays == null || this.julianDays.length < size) {
  5. int capacity = (int) (size * 1.2) + 1;
  6. this.julianDays = new int[capacity];
  7. this.nanoTimes = new long[capacity];
  8. }
  9. for (int id = 0, max = dictionary.getMaxId(); id <= max; id++) {
  10. ByteBuffer bytes = dictionary.decodeToBinary(id).toByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
  11. long time = bytes.getLong();
  12. int day = bytes.getInt();
  13. julianDays[id] = day;
  14. nanoTimes[id] = time;
  15. }
  16. }

相关文章