本文整理汇总了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());
}
示例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);
;
}
});
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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"));
}
});
}
示例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);
}
示例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));
}
示例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)
{
}
});
}
示例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);
}
示例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);
}
示例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);
}