当前位置: 首页>>代码示例>>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;未经允许,请勿转载。