本文整理汇总了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"));
}
开发者ID:HotelsDotCom,项目名称:plunger,代码行数:16,代码来源:FunctionCallStubTest.java
示例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);
}
开发者ID:vbehar,项目名称:cascading-flapi,代码行数:55,代码来源:PipeBuilderTest.java
注:本文中的cascading.operation.Identity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论