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

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

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

Utils.upperBound介绍

[英]Upper bound binary search. Find the index to the first element in the list that compares greater than the input 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 upperBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.upperBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

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

public Reader.Location getLocationByRecordNum(long recNum) {
 int idx = Utils.upperBound(recordNumIndex, recNum);
 long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1);
 return new Reader.Location(idx, recNum-lastRecNum);
}

代码示例来源: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 upperBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.upperBound(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 upperBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.upperBound(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 upperBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.upperBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

代码示例来源: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 upperBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.upperBound(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 upperBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.upperBound(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 upperBound(RawComparable key) {
 if (comparator == null) {
  throw new RuntimeException("Cannot search in unsorted TFile");
 }
 if (firstKey == null) {
  return -1; // not found
 }
 int ret = Utils.upperBound(index, key, comparator);
 if (ret == index.size()) {
  return -1;
 }
 return ret;
}

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

public Reader.Location getLocationByRecordNum(long recNum) {
 int idx = Utils.upperBound(recordNumIndex, recNum);
 long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1);
 return new Reader.Location(idx, recNum-lastRecNum);
}

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

public Reader.Location getLocationByRecordNum(long recNum) {
 int idx = Utils.upperBound(recordNumIndex, recNum);
 long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1);
 return new Reader.Location(idx, recNum-lastRecNum);
}

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

public Reader.Location getLocationByRecordNum(long recNum) {
 int idx = Utils.upperBound(recordNumIndex, recNum);
 long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1);
 return new Reader.Location(idx, recNum-lastRecNum);
}

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

public Reader.Location getLocationByRecordNum(long recNum) {
 int idx = Utils.upperBound(recordNumIndex, recNum);
 long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1);
 return new Reader.Location(idx, recNum-lastRecNum);
}

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

public Reader.Location getLocationByRecordNum(long recNum) {
 int idx = Utils.upperBound(recordNumIndex, recNum);
 long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1);
 return new Reader.Location(idx, recNum-lastRecNum);
}

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

public Reader.Location getLocationByRecordNum(long recNum) {
 int idx = Utils.upperBound(recordNumIndex, recNum);
 long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1);
 return new Reader.Location(idx, recNum-lastRecNum);
}

相关文章