當前位置: 首頁>>代碼示例>>Java>>正文


Java TextLine類代碼示例

本文整理匯總了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);
}
 
開發者ID:awslabs,項目名稱:aws-big-data-blog,代碼行數:21,代碼來源:CommonCrawlIndexTest.java

示例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));
}
 
開發者ID:elastic,項目名稱:elasticsearch-hadoop,代碼行數:22,代碼來源:AbstractCascadingLocalJsonReadTest.java

示例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));
}
 
開發者ID:elastic,項目名稱:elasticsearch-hadoop,代碼行數:26,代碼來源:AbstractCascadingLocalJsonReadTest.java

示例4: sourceTap

import cascading.scheme.local.TextLine; //導入依賴的package包/類
private Tap sourceTap() {
    return new FileTap(new TextLine(new Fields("line")), TestUtils.sampleArtistsJson());
}
 
開發者ID:xushjie1987,項目名稱:es-hadoop-v2.2.0,代碼行數:4,代碼來源:AbstractCascadingLocalJsonSaveTest.java


注:本文中的cascading.scheme.local.TextLine類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。