当前位置: 首页>>代码示例>>Java>>正文


Java FilterPlugin类代码示例

本文整理汇总了Java中org.embulk.spi.FilterPlugin的典型用法代码示例。如果您正苦于以下问题:Java FilterPlugin类的具体用法?Java FilterPlugin怎么用?Java FilterPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FilterPlugin类属于org.embulk.spi包,在下文中一共展示了FilterPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema, FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);
    String columnName = task.getQueryStringColumnName();

    Schema.Builder builder = Schema.builder();
    for (Column inputColumn : inputSchema.getColumns()) {
        if (columnName.equals(inputColumn.getName())) {
            insertColumns(builder, task.getExpandedColumns());
        }
        else {
            builder.add(inputColumn.getName(), inputColumn.getType());
        }
    }
    control.run(task.dump(), builder.build());
}
 
开发者ID:mwed,项目名称:embulk-filter-query_string,代码行数:18,代码来源:QueryStringFilterPlugin.java

示例2: testQueryString

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
private void testQueryString(ConfigSource configSource, final Schema inputSchema, final String path, final AssertionWithPage assertion)
{
    final QueryStringFilterPlugin plugin = new QueryStringFilterPlugin();
    plugin.transaction(configSource, inputSchema, new FilterPlugin.Control()
    {
        @Override
        public void run(TaskSource taskSource, Schema outputSchema)
        {
            TestPageBuilderReader.MockPageOutput mockPageOutput = new TestPageBuilderReader.MockPageOutput();
            PageOutput pageOutput = plugin.open(taskSource, inputSchema, outputSchema, mockPageOutput);

            List<Page> pages = PageTestUtils.buildPage(runtime.getBufferAllocator(), inputSchema, "before", path, "after");
            for (Page page : pages) {
                pageOutput.add(page);
            }

            pageOutput.finish();
            pageOutput.close();

            PageReader pageReader = new PageReader(outputSchema);
            assertion.run(pageReader, mockPageOutput);
            ;
        }
    });
}
 
开发者ID:mwed,项目名称:embulk-filter-query_string,代码行数:26,代码来源:TestQueryStringFilterPlugin.java

示例3: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema,
        FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    String json_template = task.getJsonColumn().getTemplate();
    BuildJsonConfigChecker checker = new BuildJsonConfigChecker(json_template,inputSchema);
    checker.validateJSON();

    Schema outputSchema = buildOutputSchema(task, inputSchema);
    for (Column column : outputSchema.getColumns()) {
        logger.debug("OutputSchema: {}", column);
    }

    control.run(task.dump(), outputSchema);
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-filter-build_json,代码行数:18,代码来源:BuildJsonFilterPlugin.java

示例4: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema,
        FilterPlugin.Control control)
{
    // check if deprecated 'time_zone' option is used.
    if (config.has("time_zone")) {
        throw new ConfigException("'time_zone' option will be deprecated");
    }

    PluginTask task = config.loadConfig(PluginTask.class);

    // check if a column specified as json_column_name option exists or not
    Column jsonColumn = inputSchema.lookupColumn(task.getJsonColumnName());
    if (jsonColumn.getType() != Types.STRING && jsonColumn.getType() != Types.JSON) {
        // throws ConfigException if the column is not string or json type.
        throw new ConfigException(String.format("A column specified as json_column_name option must be string or json type: %s",
                new Object[] {jsonColumn.toString()}));
    }
    validateExpandedColumns(task.getExpandedColumns());

    Schema outputSchema = buildOutputSchema(task, inputSchema);
    validateOutputSchema(outputSchema);
    control.run(task.dump(), outputSchema);
}
 
开发者ID:civitaspo,项目名称:embulk-filter-expand_json,代码行数:25,代码来源:ExpandJsonFilterPlugin.java

示例5: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema,
        FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    try {
        TableBuilder tableBuilder = new TableBuilder(
                task.getFilePath(),
                task.getFileFormat(),
                task.getColumns(),
                task.getCounterColumn().getName(),
                task.getJoinedColumnPrefix());
        
        task.setTable(tableBuilder.build());
    }
    catch (IOException e) {
        logger.error(e.getMessage());
        throw new RuntimeException(e);
    }

    Schema outputSchema = buildOutputSchema(inputSchema, task.getColumns(), task.getJoinedColumnPrefix());
    logger.info("output schema: {}", outputSchema);
    
    control.run(task.dump(), outputSchema);
}
 
开发者ID:civitaspo,项目名称:embulk-filter-join_file,代码行数:27,代码来源:JoinFileFilterPlugin.java

示例6: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema,
                        FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    List<Column> distinctColumns = convertNameToColumn(inputSchema, task.getDistinctColumnNames());
    task.setDistinctColumns(distinctColumns);

    if (task.getDistinctColumns().isEmpty()) {
        throw new ConfigException(
                "inputSchema does not have any columns you configured.");
    }
    else {
        logger.debug("distinct columns: {}", task.getDistinctColumns());
    }

    Schema outputSchema = inputSchema;
    control.run(task.dump(), outputSchema);
}
 
开发者ID:civitaspo,项目名称:embulk-filter-distinct,代码行数:21,代码来源:DistinctFilterPlugin.java

示例7: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema,
        FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);
    
    Schema outputSchema = buildOutputSchema(task, inputSchema);

    control.run(task.dump(), outputSchema);
}
 
开发者ID:toyama0919,项目名称:embulk-filter-google_translate_api,代码行数:11,代码来源:GoogleTranslateApiFilterPlugin.java

示例8: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema,
        FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    control.run(task.dump(), inputSchema);
}
 
开发者ID:mwed,项目名称:embulk-filter-url_encode,代码行数:9,代码来源:UrlEncodeFilterPlugin.java

示例9: testTransaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Test
public void testTransaction()
{
    ConfigSource configSource = loadConfigSource("testTransaction.yml");
    final Schema inputSchema = Schema.builder()
            .add("qb", STRING)
            .add("qs", STRING)
            .add("qa", STRING)
            .build();

    final QueryStringFilterPlugin plugin = new QueryStringFilterPlugin();

    plugin.transaction(configSource, inputSchema, new FilterPlugin.Control()
    {
        @Override
        public void run(TaskSource taskSource, Schema outputSchema)
        {
            assertThat(outputSchema.getColumnCount(), is(5));

            assertThat(outputSchema.getColumn(0).getName(), is("qb"));
            assertThat(outputSchema.getColumn(1).getName(), is("q1"));
            assertThat(outputSchema.getColumn(2).getName(), is("q2"));
            assertThat(outputSchema.getColumn(3).getName(), is("q3"));
            assertThat(outputSchema.getColumn(4).getName(), is("qa"));
        }
    });
}
 
开发者ID:mwed,项目名称:embulk-filter-query_string,代码行数:28,代码来源:TestQueryStringFilterPlugin.java

示例10: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(final ConfigSource config, final Schema inputSchema,
        final FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    configure(task, inputSchema);
    Schema outputSchema = buildOuputSchema(task, inputSchema);
    control.run(task.dump(), outputSchema);
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:11,代码来源:TypecastFilterPlugin.java

示例11: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema,
        FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    control.run(task.dump(), buildOutputSchema(task, inputSchema));
}
 
开发者ID:toyama0919,项目名称:embulk-filter-icu4j,代码行数:9,代码来源:Icu4jFilterPlugin.java

示例12: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
private void transaction(ConfigSource config, Schema inputSchema)
{
    plugin.transaction(config, inputSchema, new FilterPlugin.Control() {
        @Override
        public void run(TaskSource taskSource, Schema outputSchema)
        {
        }
    });
}
 
开发者ID:toyama0919,项目名称:embulk-filter-icu4j,代码行数:10,代码来源:TestIcu4jFilterPlugin.java

示例13: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema,
        FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    Schema outputSchema = inputSchema;

    control.run(task.dump(), outputSchema);
}
 
开发者ID:civitaspo,项目名称:embulk-filter-flatten_json,代码行数:11,代码来源:FlattenJsonFilterPlugin.java

示例14: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(final ConfigSource config, final Schema inputSchema,
        final FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    configure(task);
    Schema outputSchema = buildOutputSchema(task, inputSchema);

    control.run(task.dump(), outputSchema);
}
 
开发者ID:sonots,项目名称:embulk-filter-column,代码行数:12,代码来源:ColumnFilterPlugin.java

示例15: transaction

import org.embulk.spi.FilterPlugin; //导入依赖的package包/类
@Override
public void transaction(ConfigSource config, Schema inputSchema,
        FilterPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);

    configure(task, inputSchema);
    Schema outputSchema = inputSchema;

    control.run(task.dump(), outputSchema);
}
 
开发者ID:sonots,项目名称:embulk-filter-row,代码行数:12,代码来源:RowFilterPlugin.java


注:本文中的org.embulk.spi.FilterPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。