本文整理汇总了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));
}
示例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);
}
示例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();
}
示例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();
}
示例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));
}
示例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));
}
示例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);
}