本文整理匯總了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());
}