Search in sources :

Example 16 with Column

use of org.embulk.spi.Column in project MiscellaneousStudy by mikoto2000.

the class MyPageOutput method transaction.

@Override
public void transaction(ConfigSource config, Schema inputSchema, FilterPlugin.Control control) {
    System.out.println("transaction!");
    System.out.print("config: ");
    System.out.println(config);
    System.out.print("inputSchema: ");
    System.out.println(inputSchema);
    System.out.print("control: ");
    System.out.println(control);
    PluginTask task = config.loadConfig(PluginTask.class);
    java.util.List<Column> newSchemaColumns = inputSchema.getColumns();
    Schema.Builder builder = Schema.builder();
    // 連番カラムを追加
    builder.add("lineNumber", Types.LONG);
    for (Column column : newSchemaColumns) {
        builder.add(column.getName(), column.getType());
    }
    // 追加文字列カラムを追加
    builder.add("additional", Types.STRING);
    Schema outputSchema = builder.build();
    control.run(task.dump(), outputSchema);
}
Also used : Column(org.embulk.spi.Column) Schema(org.embulk.spi.Schema)

Aggregations

Column (org.embulk.spi.Column)16 Schema (org.embulk.spi.Schema)10 ConfigException (org.embulk.config.ConfigException)5 ConfigSource (org.embulk.config.ConfigSource)3 ColumnVisitor (org.embulk.spi.ColumnVisitor)3 DataException (org.embulk.spi.DataException)3 PageBuilder (org.embulk.spi.PageBuilder)3 JsonParseException (org.embulk.spi.json.JsonParseException)3 JsonParser (org.embulk.spi.json.JsonParser)3 ImmutableList (com.google.common.collect.ImmutableList)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 TaskSource (org.embulk.config.TaskSource)2 FilterPlugin (org.embulk.spi.FilterPlugin)2 TimestampFormatter (org.embulk.spi.time.TimestampFormatter)2 TimestampParseException (org.embulk.spi.time.TimestampParseException)2 TimestampParser (org.embulk.spi.time.TimestampParser)2 LineDecoder (org.embulk.spi.util.LineDecoder)2 Value (org.msgpack.value.Value)2