org.apache.kylin.common.util.Bytes.toDouble()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(140)

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

Bytes.toDouble介绍

暂无

代码示例

代码示例来源:origin: apache/kylin

/**
 * @param bytes byte array
 * @return Return double made from passed bytes.
 */
public static double toDouble(final byte[] bytes) {
  return toDouble(bytes, 0);
}

代码示例来源:origin: apache/kylin

public CubeStatsResult(Path path, int precision) throws IOException {
  Configuration hadoopConf = HadoopUtil.getCurrentConfiguration();
  Option seqInput = SequenceFile.Reader.file(path);
  try (Reader reader = new SequenceFile.Reader(hadoopConf, seqInput)) {
    LongWritable key = (LongWritable) ReflectionUtils.newInstance(reader.getKeyClass(), hadoopConf);
    BytesWritable value = (BytesWritable) ReflectionUtils.newInstance(reader.getValueClass(), hadoopConf);
    while (reader.next(key, value)) {
      if (key.get() == 0L) {
        percentage = Bytes.toInt(value.getBytes());
      } else if (key.get() == -1) {
        mapperOverlapRatio = Bytes.toDouble(value.getBytes());
      } else if (key.get() == -2) {
        mapperNumber = Bytes.toInt(value.getBytes());
      } else if (key.get() == -3) {
        sourceRecordCount = Bytes.toLong(value.getBytes());
      } else if (key.get() > 0) {
        HLLCounter hll = new HLLCounter(precision);
        ByteArray byteArray = new ByteArray(value.getBytes());
        hll.readRegisters(byteArray.asBuffer());
        counterMap.put(key.get(), hll);
      }
    }
  }
}

代码示例来源:origin: org.apache.kylin/kylin-common

/**
 * @param bytes byte array
 * @return Return double made from passed bytes.
 */
public static double toDouble(final byte[] bytes) {
  return toDouble(bytes, 0);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

/**
 * @param bytes byte array
 * @return Return double made from passed bytes.
 */
public static double toDouble(final byte[] bytes) {
  return toDouble(bytes, 0);
}

代码示例来源:origin: org.apache.kylin/kylin-engine-mr

public CubeStatsResult(Path path, int precision) throws IOException {
  Configuration hadoopConf = HadoopUtil.getCurrentConfiguration();
  Option seqInput = SequenceFile.Reader.file(path);
  try (Reader reader = new SequenceFile.Reader(hadoopConf, seqInput)) {
    LongWritable key = (LongWritable) ReflectionUtils.newInstance(reader.getKeyClass(), hadoopConf);
    BytesWritable value = (BytesWritable) ReflectionUtils.newInstance(reader.getValueClass(), hadoopConf);
    while (reader.next(key, value)) {
      if (key.get() == 0L) {
        percentage = Bytes.toInt(value.getBytes());
      } else if (key.get() == -1) {
        mapperOverlapRatio = Bytes.toDouble(value.getBytes());
      } else if (key.get() == -2) {
        mapperNumber = Bytes.toInt(value.getBytes());
      } else if (key.get() == -3) {
        sourceRecordCount = Bytes.toLong(value.getBytes());
      } else if (key.get() > 0) {
        HLLCounter hll = new HLLCounter(precision);
        ByteArray byteArray = new ByteArray(value.getBytes());
        hll.readRegisters(byteArray.asBuffer());
        counterMap.put(key.get(), hll);
      }
    }
  }
}

相关文章