当前位置: 首页>>代码示例>>Java>>正文


Java Range.openClosed方法代码示例

本文整理汇总了Java中com.google.common.collect.Range.openClosed方法的典型用法代码示例。如果您正苦于以下问题:Java Range.openClosed方法的具体用法?Java Range.openClosed怎么用?Java Range.openClosed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.Range的用法示例。


在下文中一共展示了Range.openClosed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.google.common.collect.Range; //导入方法依赖的package包/类
/**
 * Returns a new {@link MetricPoint} representing a value at a specific {@link Instant}.
 *
 * <p>Callers should insure that the count of {@code labelValues} matches the count of labels for
 * the given metric.
 */
@VisibleForTesting
public static <V> MetricPoint<V> create(
    Metric<V> metric, ImmutableList<String> labelValues, Instant timestamp, V value) {
  MetricsUtils.checkLabelValuesLength(metric, labelValues);

  return new AutoValue_MetricPoint<>(
      metric, labelValues, Range.openClosed(timestamp, timestamp), value);
}
 
开发者ID:google,项目名称:java-monitoring-client-library,代码行数:15,代码来源:MetricPoint.java

示例2: computeLocality

import com.google.common.collect.Range; //导入方法依赖的package包/类
private void computeLocality(ParquetMetadata footer) throws ExecutionSetupException {
  try {
    BlockMetaData block = footer.getBlocks().get(readEntry.getRowGroupIndex());

    BlockLocation[] blockLocations = fs.getFileBlockLocations(new Path(readEntry.getPath()), block.getStartingPos(), block.getCompressedSize());

    String localHost = InetAddress.getLocalHost().getCanonicalHostName();

    List<Range<Long>> intersectingRanges = new ArrayList<>();

    Range<Long> rowGroupRange = Range.openClosed(block.getStartingPos(), block.getStartingPos() + block.getCompressedSize());

    for (BlockLocation loc : blockLocations) {
      for (String host : loc.getHosts()) {
        if (host.equals(localHost)) {
          intersectingRanges.add(Range.closedOpen(loc.getOffset(), loc.getOffset() + loc.getLength()).intersection(rowGroupRange));
        }
      }
    }

    long totalIntersect = 0;
    for (Range<Long> range : intersectingRanges) {
      totalIntersect += (range.upperEndpoint() - range.lowerEndpoint());
    }
    if (totalIntersect < block.getCompressedSize()) {
      context.getStats().addLongStat(Metric.NUM_REMOTE_READERS, 1);
    } else {
      context.getStats().addLongStat(Metric.NUM_REMOTE_READERS, 0);
    }
  } catch (IOException e) {
    throw new ExecutionSetupException(e);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:34,代码来源:UnifiedParquetReader.java


注:本文中的com.google.common.collect.Range.openClosed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。