當前位置: 首頁>>代碼示例>>Java>>正文


Java FileSplit.getLocations方法代碼示例

本文整理匯總了Java中org.apache.hadoop.mapreduce.lib.input.FileSplit.getLocations方法的典型用法代碼示例。如果您正苦於以下問題:Java FileSplit.getLocations方法的具體用法?Java FileSplit.getLocations怎麽用?Java FileSplit.getLocations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.mapreduce.lib.input.FileSplit的用法示例。


在下文中一共展示了FileSplit.getLocations方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TeraScheduler

import org.apache.hadoop.mapreduce.lib.input.FileSplit; //導入方法依賴的package包/類
public TeraScheduler(FileSplit[] realSplits,
                     Configuration conf) throws IOException {
  this.realSplits = realSplits;
  this.slotsPerHost = conf.getInt(TTConfig.TT_MAP_SLOTS, 4);
  Map<String, Host> hostTable = new HashMap<String, Host>();
  splits = new Split[realSplits.length];
  for(FileSplit realSplit: realSplits) {
    Split split = new Split(realSplit.getPath().toString());
    splits[remainingSplits++] = split;
    for(String hostname: realSplit.getLocations()) {
      Host host = hostTable.get(hostname);
      if (host == null) {
        host = new Host(hostname);
        hostTable.put(hostname, host);
        hosts.add(host);
      }
      host.splits.add(split);
      split.locations.add(host);
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:22,代碼來源:TeraScheduler.java

示例2: addSplit

import org.apache.hadoop.mapreduce.lib.input.FileSplit; //導入方法依賴的package包/類
public void addSplit(FileSplit split) 
throws IOException, InterruptedException {
    splits.add(split);
    length += split.getLength();
    for (String loc : split.getLocations()) {
        if (!locations.contains(loc)) {
            locations.add(loc);
        }
    }
}
 
開發者ID:marklogic,項目名稱:marklogic-contentpump,代碼行數:11,代碼來源:CombineDocumentSplit.java

示例3: testSerialization

import org.apache.hadoop.mapreduce.lib.input.FileSplit; //導入方法依賴的package包/類
@Test
public void testSerialization() throws IOException {
  Path testPath = new Path("/foo/bar");
  String[] hosts = new String[2];
  hosts[0] = "abcd";
  hosts[1] = "efgh";
  FileSplit fSplit = new FileSplit(testPath, 1, 2, hosts);
  WikipediaInputSplit split = new WikipediaInputSplit(fSplit, 7);
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream out = new ObjectOutputStream(baos);
  split.write(out);
  out.close();
  baos.close();
  
  ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
  DataInput in = new ObjectInputStream(bais);
  
  WikipediaInputSplit split2 = new WikipediaInputSplit();
  split2.readFields(in);
  Assert.assertTrue(bais.available() == 0);
  bais.close();
  
  Assert.assertTrue(split.getPartition() == split2.getPartition());
  
  FileSplit fSplit2 = split2.getFileSplit();
  Assert.assertTrue(fSplit.getPath().equals(fSplit2.getPath()));
  Assert.assertTrue(fSplit.getStart() == fSplit2.getStart());
  Assert.assertTrue(fSplit.getLength() == fSplit2.getLength());
  
  String[] hosts2 = fSplit2.getLocations();
  Assert.assertEquals(hosts.length, hosts2.length);
  for (int i = 0; i < hosts.length; i++) {
    Assert.assertEquals(hosts[i], hosts2[i]);
  }
}
 
開發者ID:apache,項目名稱:accumulo-wikisearch,代碼行數:36,代碼來源:WikipediaInputSplitTest.java

示例4: from

import org.apache.hadoop.mapreduce.lib.input.FileSplit; //導入方法依賴的package包/類
public static CarbonInputSplit from(String segmentId, FileSplit split) throws IOException {
  return new CarbonInputSplit(segmentId, split.getPath(), split.getStart(), split.getLength(),
      split.getLocations());
}
 
開發者ID:carbondata,項目名稱:carbondata,代碼行數:5,代碼來源:CarbonInputSplit.java

示例5: FileSplitPartitionQuery

import org.apache.hadoop.mapreduce.lib.input.FileSplit; //導入方法依賴的package包/類
public FileSplitPartitionQuery(Query<K, T> baseQuery, FileSplit split)
  throws IOException {
  super(baseQuery, split.getLocations());
  this.split = split;
}
 
開發者ID:jianglibo,項目名稱:gora-boot,代碼行數:6,代碼來源:FileSplitPartitionQuery.java


注:本文中的org.apache.hadoop.mapreduce.lib.input.FileSplit.getLocations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。