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


Java Tap.openForRead方法代码示例

本文整理汇总了Java中cascading.tap.Tap.openForRead方法的典型用法代码示例。如果您正苦于以下问题:Java Tap.openForRead方法的具体用法?Java Tap.openForRead怎么用?Java Tap.openForRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cascading.tap.Tap的用法示例。


在下文中一共展示了Tap.openForRead方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPaths

import cascading.tap.Tap; //导入方法依赖的package包/类
/**
 * Tests the content of an output path against the given expected path.
 */
@SuppressWarnings("unchecked")
private void testPaths(String actual, String expected) throws Exception {

  Tap outputTest = new Hfs(new TextLine(), actual);
  Tap expectedTest = new Hfs(new TextLine(), expected);

  FlowProcess outputProcess = new HadoopFlowProcess(new JobConf(new Configuration()));
  FlowProcess expectedProcess = new HadoopFlowProcess(new JobConf(new Configuration()));

  TupleEntryIterator outputIterator = outputTest.openForRead(outputProcess);
  TupleEntryIterator expectedIterator = expectedTest.openForRead(expectedProcess);

  List<String> outputList = new ArrayList<>();
  while (outputIterator.hasNext()) {
    outputList.add(outputIterator.next().getTuple().getString(1));
  }

  List<String> expectedList = new ArrayList<>();
  while (expectedIterator.hasNext()) {
    expectedList.add(expectedIterator.next().getTuple().getString(1));
  }

  assertTrue(outputList.equals(expectedList));

}
 
开发者ID:datascienceinc,项目名称:cascading.csv,代码行数:29,代码来源:CsvSchemeTest.java

示例2: compareTaps

import cascading.tap.Tap; //导入方法依赖的package包/类
public static boolean compareTaps(final Tap source1, final Tap source2, final Configuration conf) throws IOException {
    final FlowProcess flowProcess1 = new HadoopFlowProcess(new JobConf(conf));
    source1.getScheme().retrieveSourceFields(flowProcess1, source1);
    final TupleEntryIterator iter1 = source1.openForRead(new HadoopFlowProcess(new JobConf(conf)));
    final FlowProcess flowProcess2 = new HadoopFlowProcess(new JobConf(conf));
    source2.getScheme().retrieveSourceFields(flowProcess2, source2);
    final TupleEntryIterator iter2 = source2.openForRead(new HadoopFlowProcess(new JobConf(conf)));
    if (!iter1.getFields().equals(iter2.getFields()))
        return false;
    List<Tuple> list1 = new ArrayList<Tuple>();
    while (iter1.hasNext())
        list1.add(new Tuple(iter1.next().getTuple()));
    iter1.close();
    Collections.sort(list1);
    List<Tuple> list2 = new ArrayList<Tuple>();
    while (iter2.hasNext())
        list2.add(new Tuple(iter2.next().getTuple()));
    iter2.close();
    Collections.sort(list2);
    return list1.equals(list2);
}
 
开发者ID:tresata,项目名称:cascading-opencsv,代码行数:22,代码来源:OpenCsvSchemeTest.java

示例3: getHeaderRecord

import cascading.tap.Tap; //导入方法依赖的package包/类
/**
 * Reads the header record from the source file.
 */
@SuppressWarnings("unchecked")
private CSVRecord getHeaderRecord(FlowProcess<JobConf> flowProcess, Tap tap) {
  Tap textLine = new Hfs(new TextLine(new Fields("line")), tap.getFullIdentifier(flowProcess.getConfigCopy()));

  try (TupleEntryIterator iterator = textLine.openForRead(flowProcess)) {
    String line = iterator.next().getTuple().getString(0);
    boolean skipHeaderRecord = format.getSkipHeaderRecord();
    CSVRecord headerRecord = CSVParser.parse(line, format.withSkipHeaderRecord(false)).iterator().next();
    format.withSkipHeaderRecord(skipHeaderRecord);
    return headerRecord;
  } catch (IOException e) {
    throw new TapException(e);
  }
}
 
开发者ID:datascienceinc,项目名称:cascading.csv,代码行数:18,代码来源:CsvScheme.java

示例4: getHadoopTupleEntryIterator

import cascading.tap.Tap; //导入方法依赖的package包/类
private TupleEntryIterator getHadoopTupleEntryIterator() throws IOException {
  @SuppressWarnings("unchecked")
  Tap<JobConf, ?, ?> hadoopTap = (Tap<JobConf, ?, ?>) source;
  JobConf conf = new JobConf();
  FlowProcess<JobConf> flowProcess = new HadoopFlowProcess(conf);
  hadoopTap.sourceConfInit(flowProcess, conf);
  return hadoopTap.openForRead(flowProcess);
}
 
开发者ID:HotelsDotCom,项目名称:plunger,代码行数:9,代码来源:TapDataReader.java

示例5: getLocalTupleEntryIterator

import cascading.tap.Tap; //导入方法依赖的package包/类
private TupleEntryIterator getLocalTupleEntryIterator() throws IOException {
  @SuppressWarnings("unchecked")
  Tap<Properties, ?, ?> localTap = (Tap<Properties, ?, ?>) source;
  Properties properties = new Properties();
  FlowProcess<Properties> flowProcess = new LocalFlowProcess(properties);
  localTap.sourceConfInit(flowProcess, properties);
  return localTap.openForRead(flowProcess);
}
 
开发者ID:HotelsDotCom,项目名称:plunger,代码行数:9,代码来源:TapDataReader.java

示例6: openTapForRead

import cascading.tap.Tap; //导入方法依赖的package包/类
@Override
public TupleEntryIterator openTapForRead(Tap tap) throws IOException {
	return tap.openForRead( this );
}
 
开发者ID:dataArtisans,项目名称:cascading-flink,代码行数:5,代码来源:FlinkFlowProcess.java


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