org.apache.hadoop.io.file.tfile.Utils.lowerBound()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(89)

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

Utils.lowerBound介绍

[英]Lower bound binary search. Find the index to the first element in the list that compares greater than or equal to key.
[中]下限二进制搜索。查找列表中第一个比较大于或等于key的元素的索引。

代码示例

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

/**
 * @param key
 *          input key.
 * @return the ID of the first block that contains key >= input key. Or -1
 *         if no such block exists.
 */
public int lowerBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.lowerBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

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

/**
  * Find the smallest Block index whose starting offset is greater than or
  * equal to the specified offset.
  * 
  * @param offset
  *          User-specific offset.
  * @return the index to the data Block if such block exists; or -1
  *         otherwise.
  */
 public int getBlockIndexNear(long offset) {
  ArrayList<BlockRegion> list = dataIndex.getBlockRegionList();
  int idx =
    Utils
      .lowerBound(list, new ScalarLong(offset), new ScalarComparator());
  if (idx == list.size()) {
   return -1;
  }
  return idx;
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
 * @param key
 *          input key.
 * @return the ID of the first block that contains key >= input key. Or -1
 *         if no such block exists.
 */
public int lowerBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.lowerBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

代码示例来源:origin: io.hops/hadoop-common

/**
 * @param key
 *          input key.
 * @return the ID of the first block that contains key >= input key. Or -1
 *         if no such block exists.
 */
public int lowerBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.lowerBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/**
 * @param key
 *          input key.
 * @return the ID of the first block that contains key >= input key. Or -1
 *         if no such block exists.
 */
public int lowerBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.lowerBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

代码示例来源:origin: org.apache.apex/malhar-library

/**
 * @param key
 *          input key.
 * @return the ID of the first block that contains key >= input key. Or -1
 *         if no such block exists.
 */
public int lowerBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.lowerBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * @param key
 *          input key.
 * @return the ID of the first block that contains key >= input key. Or -1
 *         if no such block exists.
 */
public int lowerBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.lowerBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
 * @param key
 *          input key.
 * @return the ID of the first block that contains key >= input key. Or -1
 *         if no such block exists.
 */
public int lowerBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.lowerBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/**
  * Find the smallest Block index whose starting offset is greater than or
  * equal to the specified offset.
  * 
  * @param offset
  *          User-specific offset.
  * @return the index to the data Block if such block exists; or -1
  *         otherwise.
  */
 public int getBlockIndexNear(long offset) {
  ArrayList<BlockRegion> list = dataIndex.getBlockRegionList();
  int idx =
    Utils
      .lowerBound(list, new ScalarLong(offset), new ScalarComparator());
  if (idx == list.size()) {
   return -1;
  }
  return idx;
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
  * Find the smallest Block index whose starting offset is greater than or
  * equal to the specified offset.
  * 
  * @param offset
  *          User-specific offset.
  * @return the index to the data Block if such block exists; or -1
  *         otherwise.
  */
 public int getBlockIndexNear(long offset) {
  ArrayList<BlockRegion> list = dataIndex.getBlockRegionList();
  int idx =
    Utils
      .lowerBound(list, new ScalarLong(offset), new ScalarComparator());
  if (idx == list.size()) {
   return -1;
  }
  return idx;
 }
}

代码示例来源:origin: io.hops/hadoop-common

/**
  * Find the smallest Block index whose starting offset is greater than or
  * equal to the specified offset.
  * 
  * @param offset
  *          User-specific offset.
  * @return the index to the data Block if such block exists; or -1
  *         otherwise.
  */
 public int getBlockIndexNear(long offset) {
  ArrayList<BlockRegion> list = dataIndex.getBlockRegionList();
  int idx =
    Utils
      .lowerBound(list, new ScalarLong(offset), new ScalarComparator());
  if (idx == list.size()) {
   return -1;
  }
  return idx;
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
  * Find the smallest Block index whose starting offset is greater than or
  * equal to the specified offset.
  * 
  * @param offset
  *          User-specific offset.
  * @return the index to the data Block if such block exists; or -1
  *         otherwise.
  */
 public int getBlockIndexNear(long offset) {
  ArrayList<BlockRegion> list = dataIndex.getBlockRegionList();
  int idx =
    Utils
      .lowerBound(list, new ScalarLong(offset), new ScalarComparator());
  if (idx == list.size()) {
   return -1;
  }
  return idx;
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
  * Find the smallest Block index whose starting offset is greater than or
  * equal to the specified offset.
  * 
  * @param offset
  *          User-specific offset.
  * @return the index to the data Block if such block exists; or -1
  *         otherwise.
  */
 public int getBlockIndexNear(long offset) {
  ArrayList<BlockRegion> list = dataIndex.getBlockRegionList();
  int idx =
    Utils
      .lowerBound(list, new ScalarLong(offset), new ScalarComparator());
  if (idx == list.size()) {
   return -1;
  }
  return idx;
 }
}

代码示例来源:origin: org.apache.apex/malhar-library

/**
  * Find the smallest Block index whose starting offset is greater than or
  * equal to the specified offset.
  *
  * @param offset
  *          User-specific offset.
  * @return the index to the data Block if such block exists; or -1
  *         otherwise.
  */
 public int getBlockIndexNear(long offset) {
  ArrayList<BlockRegion> list = dataIndex.getBlockRegionList();
  int idx =
    Utils
      .lowerBound(list, new ScalarLong(offset), new ScalarComparator());
  if (idx == list.size()) {
   return -1;
  }
  return idx;
 }
}

相关文章