本文整理汇总了Java中cascading.scheme.local.TextLine类的典型用法代码示例。如果您正苦于以下问题:Java TextLine类的具体用法?Java TextLine怎么用?Java TextLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextLine类属于cascading.scheme.local包,在下文中一共展示了TextLine类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateCommonCrawlFlowDef
import cascading.scheme.local.TextLine; //导入依赖的package包/类
@Test
public void testCreateCommonCrawlFlowDef() throws Exception {
Properties properties = new ConfigReader().renderProperties(CommonCrawlIndexTest.class);
String sourcePath = properties.getProperty("inPath");
String sinkPath = properties.getProperty("testCreateCommonCrawlFlowDefOutput");
String sinkValidationPath = properties.getProperty("testCreateCommonCrawlFlowDefOutputValidation");
// create the Cascading "source" (input) tap to read the commonCrawl WAT file(s)
Tap source = new FileTap(new TextLine(new Fields("line")) ,sourcePath);
// create the Cascading "sink" (output) tap to dump the results
Tap sink = new FileTap(new TextLine(new Fields("line")) ,sinkPath);
//Build the Cascading Flow Definition
FlowDef flowDef = CommonCrawlIndex.createCommonCrawlFlowDef(source, sink);
new LocalFlowConnector(properties).connect(flowDef).complete();
Assert.sameContent(sinkPath, sinkValidationPath);
}
示例2: testReadFromES
import cascading.scheme.local.TextLine; //导入依赖的package包/类
@Test
public void testReadFromES() throws Exception {
Tap in = new EsTap(indexPrefix + "cascading-local-artists/data");
Pipe pipe = new Pipe("copy");
ByteArrayOutputStream os = new ByteArrayOutputStream();
Tap out = new OutputStreamTap(new TextLine(), os);
build(cfg(), in, out, pipe);
BufferedReader r = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(os.toByteArray())));
List<String> records = new ArrayList<>();
for (String line = r.readLine(); line != null; line = r.readLine()) {
records.add(line);
}
String doc1 = "{\"number\":\"917\",\"name\":\"Iron Maiden\",\"url\":\"http://www.last.fm/music/Iron+Maiden\",\"picture\":\"http://userserve-ak.last.fm/serve/252/22493569.jpg\",\"@timestamp\":\"2017-10-06T19:20:25.000Z\",\"list\":[\"quick\", \"brown\", \"fox\"],\"tag\":\"9\"}";
String doc2 = "{\"number\":\"979\",\"name\":\"Smash Mouth\",\"url\":\"http://www.last.fm/music/Smash+Mouth\",\"picture\":\"http://userserve-ak.last.fm/serve/252/82063.jpg\",\"@timestamp\":\"2017-10-06T19:20:25.000Z\",\"list\":[\"quick\", \"brown\", \"fox\"],\"tag\":\"9\"}";
String doc3 = "{\"number\":\"190\",\"name\":\"Muse\",\"url\":\"http://www.last.fm/music/Muse\",\"picture\":\"http://userserve-ak.last.fm/serve/252/416514.jpg\",\"@timestamp\":\"2005-10-06T19:20:25.000Z\",\"list\":[\"quick\", \"brown\", \"fox\"],\"tag\":\"1\"}";
assertThat(records, hasItems(doc1, doc2, doc3));
}
示例3: testReadFromESWithSourceFilter
import cascading.scheme.local.TextLine; //导入依赖的package包/类
@Test
public void testReadFromESWithSourceFilter() throws Exception {
Tap in = new EsTap(indexPrefix + "cascading-local-artists/data");
Pipe pipe = new Pipe("copy");
ByteArrayOutputStream os = new ByteArrayOutputStream();
Tap out = new OutputStreamTap(new TextLine(), os);
Properties cfg = cfg();
cfg.setProperty("es.read.source.filter", "name");
build(cfg, in, out, pipe);
BufferedReader r = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(os.toByteArray())));
List<String> records = new ArrayList<>();
for (String line = r.readLine(); line != null; line = r.readLine()) {
records.add(line);
}
String doc1 = "{\"name\":\"Iron Maiden\"}";
String doc2 = "{\"name\":\"Smash Mouth\"}";
String doc3 = "{\"name\":\"Muse\"}";
assertThat(records, hasItems(doc1, doc2, doc3));
}
示例4: sourceTap
import cascading.scheme.local.TextLine; //导入依赖的package包/类
private Tap sourceTap() {
return new FileTap(new TextLine(new Fields("line")), TestUtils.sampleArtistsJson());
}