本文整理汇总了Java中cascading.operation.Identity类的典型用法代码示例。如果您正苦于以下问题:Java Identity类的具体用法?Java Identity怎么用?Java Identity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Identity类属于cascading.operation包,在下文中一共展示了Identity类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: complete
import cascading.operation.Identity; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void complete() {
List<TupleEntry> actual = new FunctionCallStub.Builder(FIELDS)
.addTuple("a")
.addTuple("b")
.build()
.complete(mock(FlowProcess.class), new Identity())
.result()
.asTupleEntryList();
assertThat(actual.size(), is(2));
assertThat(actual.get(0), tupleEntry(FIELDS, "a"));
assertThat(actual.get(1), tupleEntry(FIELDS, "b"));
}
示例2: complexPipe
import cascading.operation.Identity; //导入依赖的package包/类
@Test
public void complexPipe() throws Exception {
Pipe pipe = PipeBuilder.start()
.each().select("data").filterOut().nullValues()
.each().insertField("processingDate").withValue(System.currentTimeMillis())
.renameField("domains").to("oldDomains")
.each().select("url").applyFunction(new ExpressionFunction(new Fields("isRelativeUrl"), "url.startsWith(\"http\")", String.class))
.compressOutput().forThisStepOnly().withGzipCodec().withType("BLOCK").ofTheMappers()
.discard("data")
.groupBy().withSortOnFields("url").onFields("domain")
.count("domains")
.pipe();
// count
assertThat(pipe).isInstanceOf(Every.class);
assertThat(((Every)pipe).getOperation()).isInstanceOf(Count.class);
// groupBy
pipe = pipe.getPrevious()[0];
assertThat(pipe).isInstanceOf(GroupBy.class);
// discard
pipe = pipe.getPrevious()[0];
assertThat(pipe).isInstanceOf(Discard.class);
pipe = pipe.getPrevious()[0];
assertThat(pipe).isInstanceOf(Each.class);
assertThat(((Each)pipe).getOperation()).isInstanceOf(NoOp.class);
// expression
pipe = pipe.getPrevious()[0];
assertThat(pipe).isInstanceOf(Each.class);
assertThat(((Each)pipe).getOperation()).isInstanceOf(ExpressionFunction.class);
// rename
pipe = pipe.getPrevious()[0];
assertThat(pipe).isInstanceOf(Rename.class);
pipe = pipe.getPrevious()[0];
assertThat(pipe).isInstanceOf(Each.class);
assertThat(((Each)pipe).getOperation()).isInstanceOf(Identity.class);
// insert
pipe = pipe.getPrevious()[0];
assertThat(pipe).isInstanceOf(Each.class);
assertThat(((Each)pipe).getOperation()).isInstanceOf(Insert.class);
// filter null
pipe = pipe.getPrevious()[0];
assertThat(pipe).isInstanceOf(Each.class);
assertThat(((Each)pipe).getOperation()).isInstanceOf(FilterNull.class);
// initial pipe
pipe = pipe.getPrevious()[0];
assertThat(pipe.getClass()).isEqualTo(Pipe.class);
}