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


Java Range类代码示例

本文整理汇总了Java中org.apache.hadoop.mapred.SortedRanges.Range的典型用法代码示例。如果您正苦于以下问题:Java Range类的具体用法?Java Range怎么用?Java Range使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: reportNextRecordRange

import org.apache.hadoop.mapred.SortedRanges.Range; //导入依赖的package包/类
@Override
public void reportNextRecordRange(TaskAttemptID taskAttemptID, Range range)
    throws IOException {
  // This is used when the feature of skipping records is enabled.

  // This call exists as a hadoop mapreduce legacy wherein all changes in
  // counters/progress/phase/output-size are reported through statusUpdate()
  // call but not the next record range information.
  throw new IOException("Not yet implemented.");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:TaskAttemptListenerImpl.java

示例2: testAdd

import org.apache.hadoop.mapred.SortedRanges.Range; //导入依赖的package包/类
public void testAdd() {
  SortedRanges sr = new SortedRanges();
  sr.add(new Range(2,9));
  assertEquals(9, sr.getIndicesCount());
  
  sr.add(new SortedRanges.Range(3,5));
  assertEquals(9, sr.getIndicesCount());
  
  sr.add(new SortedRanges.Range(7,1));
  assertEquals(9, sr.getIndicesCount());
  
  sr.add(new Range(1,12));
  assertEquals(12, sr.getIndicesCount());
  
  sr.add(new Range(7,9));
  assertEquals(15, sr.getIndicesCount());
  
  sr.add(new Range(31,10));
  sr.add(new Range(51,10));
  sr.add(new Range(66,10));
  assertEquals(45, sr.getIndicesCount());
  
  sr.add(new Range(21,50));
  assertEquals(70, sr.getIndicesCount());
  
  LOG.debug(sr);
  
  Iterator<Long> it = sr.skipRangeIterator();
  int i = 0;
  assertEquals(i, it.next().longValue());
  for(i=16;i<21;i++) {
    assertEquals(i, it.next().longValue());
  }
  assertEquals(76, it.next().longValue());
  assertEquals(77, it.next().longValue());
  
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:TestSortedRanges.java

示例3: testRemove

import org.apache.hadoop.mapred.SortedRanges.Range; //导入依赖的package包/类
public void testRemove() {
  SortedRanges sr = new SortedRanges();
  sr.add(new Range(2,19));
  assertEquals(19, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(15,8));
  assertEquals(13, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(6,5));
  assertEquals(8, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(8,4));
  assertEquals(7, sr.getIndicesCount());
  
  sr.add(new Range(18,5));
  assertEquals(12, sr.getIndicesCount());
  
  sr.add(new Range(25,1));
  assertEquals(13, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(7,24));
  assertEquals(4, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(5,1));
  assertEquals(3, sr.getIndicesCount());
  
  LOG.debug(sr);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestSortedRanges.java

示例4: add

import org.apache.hadoop.mapred.SortedRanges.Range; //导入依赖的package包/类
synchronized void add(Range failedRange) {
  LOG.warn("FailedRange:"+ failedRange);
  if(divide!=null) {
    LOG.warn("FailedRange:"+ failedRange +"  test:"+divide.test +
        "  pass:"+divide.testPassed);
    if(divide.testPassed) {
      //test range passed
      //other range would be bad. test it
      failedRange = divide.other;
    }
    else {
      //test range failed
      //other range would be good.
      failedRange = divide.test;
    }
    //reset
    divide = null;
  }
  
  if(maxSkipRecords==0 || failedRange.getLength()<=maxSkipRecords) {
    skipRanges.add(failedRange);
  } else {
    //start dividing the range to narrow down the skipped
    //records until maxSkipRecords are met OR all attempts
    //get exhausted
    divide = new Divide(failedRange);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:29,代码来源:TaskInProgress.java

示例5: Divide

import org.apache.hadoop.mapred.SortedRanges.Range; //导入依赖的package包/类
Divide(Range range){
  long half = range.getLength()/2;
  test = new Range(range.getStartIndex(), half);
  other = new Range(test.getEndIndex(), range.getLength()-half);
  //construct the skip range from the skipRanges
  skipRange = new SortedRanges();
  for(Range r : skipRanges.getRanges()) {
    skipRange.add(r);
  }
  skipRange.add(new Range(0,test.getStartIndex()));
  skipRange.add(new Range(test.getEndIndex(), 
      (Long.MAX_VALUE-test.getEndIndex())));
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:14,代码来源:TaskInProgress.java

示例6: testAdd

import org.apache.hadoop.mapred.SortedRanges.Range; //导入依赖的package包/类
@Test
public void testAdd() {
  SortedRanges sr = new SortedRanges();
  sr.add(new Range(2,9));
  assertEquals(9, sr.getIndicesCount());
  
  sr.add(new SortedRanges.Range(3,5));
  assertEquals(9, sr.getIndicesCount());
  
  sr.add(new SortedRanges.Range(7,1));
  assertEquals(9, sr.getIndicesCount());
  
  sr.add(new Range(1,12));
  assertEquals(12, sr.getIndicesCount());
  
  sr.add(new Range(7,9));
  assertEquals(15, sr.getIndicesCount());
  
  sr.add(new Range(31,10));
  sr.add(new Range(51,10));
  sr.add(new Range(66,10));
  assertEquals(45, sr.getIndicesCount());
  
  sr.add(new Range(21,50));
  assertEquals(70, sr.getIndicesCount());
  
  LOG.debug(sr);
  
  Iterator<Long> it = sr.skipRangeIterator();
  int i = 0;
  assertEquals(i, it.next().longValue());
  for(i=16;i<21;i++) {
    assertEquals(i, it.next().longValue());
  }
  assertEquals(76, it.next().longValue());
  assertEquals(77, it.next().longValue());
  
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:39,代码来源:TestSortedRanges.java

示例7: testRemove

import org.apache.hadoop.mapred.SortedRanges.Range; //导入依赖的package包/类
@Test
public void testRemove() {
  SortedRanges sr = new SortedRanges();
  sr.add(new Range(2,19));
  assertEquals(19, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(15,8));
  assertEquals(13, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(6,5));
  assertEquals(8, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(8,4));
  assertEquals(7, sr.getIndicesCount());
  
  sr.add(new Range(18,5));
  assertEquals(12, sr.getIndicesCount());
  
  sr.add(new Range(25,1));
  assertEquals(13, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(7,24));
  assertEquals(4, sr.getIndicesCount());
  
  sr.remove(new SortedRanges.Range(5,1));
  assertEquals(3, sr.getIndicesCount());
  
  LOG.debug(sr);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:30,代码来源:TestSortedRanges.java


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