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


Java TupleEntryCollector.add方法代码示例

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


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

示例1: writeToHadoopPartitionTap

import cascading.tuple.TupleEntryCollector; //导入方法依赖的package包/类
private void writeToHadoopPartitionTap(Tap<?, ?, ?> tap) throws IOException {
  @SuppressWarnings("unchecked")
  BasePartitionTap<JobConf, ?, ?> hadoopTap = (BasePartitionTap<JobConf, ?, ?>) tap;
  JobConf conf = new JobConf();

  // Avoids deletion of results when using a partition tap (close() will delete the _temporary before the copy has
  // been done if not in a flow)
  HadoopUtil.setIsInflow(conf);

  HadoopFlowProcess flowProcess = new HadoopFlowProcess(conf);
  hadoopTap.sinkConfInit(flowProcess, conf);
  TupleEntryCollector collector = hadoopTap.openForWrite(flowProcess);
  for (TupleEntry tuple : data.asTupleEntryList()) {
    collector.add(tuple);
  }
  collector.close();

  // We need to clean up the '_temporary' folder
  BasePartitionTap<JobConf, ?, ?> partitionTap = hadoopTap;
  @SuppressWarnings("unchecked")
  String basePath = partitionTap.getParent().getFullIdentifier(flowProcess);
  deleteTemporaryPath(new Path(basePath), FileSystem.get(conf));
}
 
开发者ID:HotelsDotCom,项目名称:plunger,代码行数:24,代码来源:TapDataWriter.java

示例2: writeToLocalTap

import cascading.tuple.TupleEntryCollector; //导入方法依赖的package包/类
private void writeToLocalTap(Tap<?, ?, ?> tap) throws IOException {
  @SuppressWarnings("unchecked")
  Tap<Properties, ?, ?> localTap = (Tap<Properties, ?, ?>) tap;
  Properties conf = new Properties();
  LocalFlowProcess flowProcess = new LocalFlowProcess(conf);

  flowProcess.setStepStats(new LocalStepStats(new NullFlowStep(), NullClientState.INSTANCE));

  localTap.sinkConfInit(flowProcess, conf);
  TupleEntryCollector collector = localTap.openForWrite(flowProcess);
  for (TupleEntry tuple : data.asTupleEntryList()) {
    collector.add(tuple);
  }
  collector.close();
  localTap.commitResource(conf);
}
 
开发者ID:HotelsDotCom,项目名称:plunger,代码行数:17,代码来源:TapDataWriter.java

示例3: exerciseScheme

import cascading.tuple.TupleEntryCollector; //导入方法依赖的package包/类
@Test
public void exerciseScheme() throws IOException {
  TupleEntryCollector collector = tap.openForWrite(flowProcess);
  for (Tuple tuple : tuples) {
    collector.add(tuple);
  }
  collector.close();
}
 
开发者ID:HotelsDotCom,项目名称:corc,代码行数:9,代码来源:OrcFileSinkPerformanceTest.java

示例4: writeToHadoopTap

import cascading.tuple.TupleEntryCollector; //导入方法依赖的package包/类
private void writeToHadoopTap(Tap<?, ?, ?> tap) throws IOException {
  @SuppressWarnings("unchecked")
  Tap<JobConf, ?, ?> hadoopTap = (Tap<JobConf, ?, ?>) tap;
  JobConf conf = new JobConf();

  HadoopFlowProcess flowProcess = new HadoopFlowProcess(conf);
  hadoopTap.sinkConfInit(flowProcess, conf);
  TupleEntryCollector collector = hadoopTap.openForWrite(flowProcess);
  for (TupleEntry tuple : data.asTupleEntryList()) {
    collector.add(tuple);
  }
  collector.close();
}
 
开发者ID:HotelsDotCom,项目名称:plunger,代码行数:14,代码来源:TapDataWriter.java

示例5: asTupleEntryList

import cascading.tuple.TupleEntryCollector; //导入方法依赖的package包/类
@Test
public void asTupleEntryList() throws IOException {
  Bucket sink = new Bucket(FIELDS, pipe, flow);
  TupleEntryCollector collector = sink.openForWrite(null, null);
  collector.add(TUPLE_1);
  collector.add(TUPLE_2);
  List<TupleEntry> tupleEntryList = sink.result().asTupleEntryList();
  assertThat(tupleEntryList.size(), is(2));
  assertThat(tupleEntryList.get(0).getFields(), is(FIELDS));
  assertThat(tupleEntryList.get(0).getTuple(), is(TUPLE_1));
  assertThat(tupleEntryList.get(1).getFields(), is(FIELDS));
  assertThat(tupleEntryList.get(1).getTuple(), is(TUPLE_2));
}
 
开发者ID:HotelsDotCom,项目名称:plunger,代码行数:14,代码来源:BucketTest.java

示例6: asTupleList

import cascading.tuple.TupleEntryCollector; //导入方法依赖的package包/类
@Test
public void asTupleList() throws IOException {
  Bucket sink = new Bucket(FIELDS, pipe, flow);
  TupleEntryCollector collector = sink.openForWrite(null, null);
  collector.add(TUPLE_1);
  collector.add(TUPLE_2);
  List<Tuple> tupleList = sink.result().asTupleList();
  assertThat(tupleList.size(), is(2));
  assertThat(tupleList.get(0), is(TUPLE_1));
  assertThat(tupleList.get(1), is(TUPLE_2));
}
 
开发者ID:HotelsDotCom,项目名称:plunger,代码行数:12,代码来源:BucketTest.java

示例7: operate

import cascading.tuple.TupleEntryCollector; //导入方法依赖的package包/类
@Override
public void operate(FlowProcess flowProcess, FunctionCall<Object> functionCall){
	Evaluator evaluator = getEvaluator();

	TupleEntry input = functionCall.getArguments();

	Map<FieldName, FieldValue> arguments = decodeArguments(evaluator, input);

	Map<FieldName, ?> result = evaluator.evaluate(arguments);

	TupleEntry output = encodeResult(evaluator, getFieldDeclaration(), result);

	TupleEntryCollector outputCollector = functionCall.getOutputCollector();

	outputCollector.add(output);
}
 
开发者ID:jpmml,项目名称:jpmml-cascading,代码行数:17,代码来源:PMMLFunction.java


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