本文整理汇总了Java中org.apache.giraph.io.EdgeReader类的典型用法代码示例。如果您正苦于以下问题:Java EdgeReader类的具体用法?Java EdgeReader怎么用?Java EdgeReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EdgeReader类属于org.apache.giraph.io包,在下文中一共展示了EdgeReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createEdgeReader
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Override
public EdgeReader<I, E> createEdgeReader(InputSplit split,
TaskAttemptContext context)
throws IOException {
HiveEdgeReader<I, E> reader = new HiveEdgeReader<I, E>();
reader.setTableSchema(getTableSchema());
RecordReader<WritableComparable, HiveReadableRecord> baseReader;
try {
baseReader = hiveInputFormat.createRecordReader(split, context);
} catch (InterruptedException e) {
throw new IllegalStateException("Could not create edge record reader", e);
}
reader.setHiveRecordReader(baseReader);
return new EdgeReaderWrapper<I, E>(reader);
}
开发者ID:renato2099,项目名称:giraph-gora,代码行数:19,代码来源:HiveEdgeInputFormat.java
示例2: createEdgeReader
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Override
public EdgeReader<I, E> createEdgeReader(InputSplit split,
TaskAttemptContext context)
throws IOException {
HiveEdgeReader<I, E> reader = new HiveEdgeReader<I, E>();
reader.setTableSchema(hiveInputFormat.getTableSchema(getConf()));
RecordReader<WritableComparable, HiveReadableRecord> baseReader;
try {
baseReader = hiveInputFormat.createRecordReader(split, context);
} catch (InterruptedException e) {
throw new IllegalStateException("Could not create edge record reader", e);
}
reader.setHiveRecordReader(baseReader);
return new EdgeReaderWrapper<I, E>(reader);
}
开发者ID:zfighter,项目名称:giraph-research,代码行数:19,代码来源:HiveEdgeInputFormat.java
示例3: createEdgeReader
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Override
public EdgeReader<IntWritable, IntWritable> createEdgeReader(
InputSplit split, TaskAttemptContext context) throws IOException {
String duplicator = this.getConf().get("io.edge.reverse.duplicator");
boolean useDuplicator = (null != duplicator) ? Boolean.parseBoolean(duplicator) : false;
EdgeReader<IntWritable,IntWritable> reader = (useDuplicator) ? new ReverseEdgeDuplicator<IntWritable, IntWritable>(new SBEdgeReader()) : new SBEdgeReader();
return reader;
}
开发者ID:Sotera,项目名称:high-betweenness-set-extraction,代码行数:9,代码来源:HBSEEdgeInputFormat.java
示例4: createEdgeReader
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
public EdgeReader<Text, Text> createEdgeReader(final RecordReader<LongWritable,Text> rr) throws IOException {
return new DGATextEdgeValueReader(){
@Override
protected RecordReader<LongWritable, Text> createLineRecordReader(InputSplit inputSplit, TaskAttemptContext context) throws IOException, InterruptedException {
return rr;
}
};
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:9,代码来源:DGATextEdgeValueInputFormatTest.java
示例5: testInputParserWithDefaultWeight
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithDefaultWeight() throws IOException, InterruptedException {
String input = "1,2";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text(""));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:13,代码来源:DGATextEdgeValueInputFormatTest.java
示例6: testInputParserWithDefaultWeightAndOverriddenSeparator
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithDefaultWeightAndOverriddenSeparator() throws IOException, InterruptedException {
String input = "1\t2";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text());
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:14,代码来源:DGATextEdgeValueInputFormatTest.java
示例7: testInputParserWithCustomWeight
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithCustomWeight() throws IOException, InterruptedException {
String input = "1,2,10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text("10"));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:13,代码来源:DGATextEdgeValueInputFormatTest.java
示例8: testInputParserIgnoreWeight
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserIgnoreWeight() throws IOException, InterruptedException {
String input = "1,2,10";
conf.set(IO_IGNORE_THIRD, "true");
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text(""));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:14,代码来源:DGATextEdgeValueInputFormatTest.java
示例9: testInputParserWithCustomWeightAndOverriddenSeparator
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithCustomWeightAndOverriddenSeparator() throws IOException, InterruptedException {
String input = "1\t2\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text("10"));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:14,代码来源:DGATextEdgeValueInputFormatTest.java
示例10: testInputParserWithDelimiterInData
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithDelimiterInData() throws IOException, InterruptedException {
String input = "te\\[email protected]\[email protected]\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("te\\[email protected]"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("[email protected]"));
assertEquals(ter.getCurrentEdge().getValue(), new Text("10"));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:14,代码来源:DGATextEdgeValueInputFormatTest.java
示例11: testInputParserWithDelimiterInDataNoEscape
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithDelimiterInDataNoEscape() throws IOException, InterruptedException {
String input = "te\[email protected]\[email protected]\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("te"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("[email protected]"));
assertEquals(ter.getCurrentEdge().getValue(), new Text("[email protected]"));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:14,代码来源:DGATextEdgeValueInputFormatTest.java
示例12: testInputParserWithMalformedLine
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test(expected=IOException.class)
public void testInputParserWithMalformedLine() throws IOException, InterruptedException {
String input = "1";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text());
assertEquals(ter.getCurrentEdge().getValue(), new Text());
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:13,代码来源:DGATextEdgeValueInputFormatTest.java
示例13: testInputParserWithMalformedLineAndDelimiter
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test(expected=IOException.class)
public void testInputParserWithMalformedLineAndDelimiter() throws IOException, InterruptedException {
String input = "1,";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text());
assertEquals(ter.getCurrentEdge().getValue(), new Text());
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:13,代码来源:DGATextEdgeValueInputFormatTest.java
示例14: testInputParserWithMalformedLineAndDelimiterNoSource
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test(expected=IOException.class)
public void testInputParserWithMalformedLineAndDelimiterNoSource() throws IOException, InterruptedException {
String input = ",1";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text());
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getValue(), new Text());
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:13,代码来源:DGATextEdgeValueInputFormatTest.java
示例15: createEdgeReader
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
public EdgeReader<Text, LongWritable> createEdgeReader(final RecordReader<LongWritable,Text> rr) throws IOException {
return new DGALongEdgeValueReader(){
@Override
protected RecordReader<LongWritable, Text> createLineRecordReader(InputSplit inputSplit, TaskAttemptContext context) throws IOException, InterruptedException {
return rr;
}
};
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:9,代码来源:DGALongEdgeValueInputFormatTest.java
示例16: testInputParserWithDefaultWeight
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithDefaultWeight() throws IOException, InterruptedException {
String input = "1,2";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(1L));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:13,代码来源:DGALongEdgeValueInputFormatTest.java
示例17: testInputParserWithDefaultWeightAndOverriddenSeparator
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithDefaultWeightAndOverriddenSeparator() throws IOException, InterruptedException {
String input = "1\t2";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(1L));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:14,代码来源:DGALongEdgeValueInputFormatTest.java
示例18: testInputParserWithCustomWeight
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithCustomWeight() throws IOException, InterruptedException {
String input = "1,2,10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(10L));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:13,代码来源:DGALongEdgeValueInputFormatTest.java
示例19: testInputParserWithCustomWeightAndOverriddenSeparator
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithCustomWeightAndOverriddenSeparator() throws IOException, InterruptedException {
String input = "1\t2\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(10L));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:14,代码来源:DGALongEdgeValueInputFormatTest.java
示例20: testInputParserWithDelimiterInData
import org.apache.giraph.io.EdgeReader; //导入依赖的package包/类
@Test
public void testInputParserWithDelimiterInData() throws IOException, InterruptedException {
String input = "te\\[email protected]\[email protected]\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("te\\[email protected]"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("[email protected]"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(10L));
}
开发者ID:Sotera,项目名称:distributed-graph-analytics,代码行数:14,代码来源:DGALongEdgeValueInputFormatTest.java
注:本文中的org.apache.giraph.io.EdgeReader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论