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


Java Schema.getColumns方法代码示例

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


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

示例1: getColumnOptions

import org.embulk.spi.Schema; //导入方法依赖的package包/类
HashMap<Column, Map<String, Integer>> getColumnOptions(PluginTask task)
{
    SchemaConfig schemaConfig = task.getSchema();
    Schema schema = schemaConfig.toSchema();
    HashMap<Column, Map<String, Integer>> lengthMap = new HashMap<>();
    for (Column column : schema.getColumns()) {
        HashMap<String, Integer> miniMap = new HashMap<>();
        ColumnConfig c = schemaConfig.getColumn(column.getIndex());
        miniMap.put("length", c.getOption().get(Integer.class, "length", 0));
        miniMap.put("null_rate", c.getOption().get(Integer.class, "null_rate", 0));
        miniMap.put("max_value", c.getOption().get(Integer.class, "max_value", null));
        miniMap.put("min_value", c.getOption().get(Integer.class, "min_value", null));
        lengthMap.put(column, miniMap);
    }
    return lengthMap;
}
 
开发者ID:yuokada,项目名称:embulk-input-randomj,代码行数:17,代码来源:RandomjInputPlugin.java

示例2: transaction

import org.embulk.spi.Schema; //导入方法依赖的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

示例3: transaction

import org.embulk.spi.Schema; //导入方法依赖的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: buildOutputSchema

import org.embulk.spi.Schema; //导入方法依赖的package包/类
static Schema buildOutputSchema(PluginTask task, Schema inputSchema)
{
    Type jsonColumnType = jsonColumnType(task);
    String jsonColumnName = task.getJsonColumn().getName();

    Schema.Builder builder = Schema.builder();
    int found = 0;

    for (Column inputColumns : inputSchema.getColumns()) {
        if (jsonColumnName.equals(inputColumns.getName())) {
            builder.add(inputColumns.getName(), jsonColumnType);
            found = 1;
        }
        else {
            builder.add(inputColumns.getName(), inputColumns.getType());
        }
    }
    if (found == 0) {
        builder.add(jsonColumnName, jsonColumnType);
    }

    return builder.build();
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-filter-build_json,代码行数:24,代码来源:BuildJsonFilterPlugin.java

示例5: buildOuputSchema

import org.embulk.spi.Schema; //导入方法依赖的package包/类
private Schema buildOuputSchema(final PluginTask task, final Schema inputSchema)
{
    List<ColumnConfig> columnConfigs = task.getColumns();
    ImmutableList.Builder<Column> builder = ImmutableList.builder();
    int i = 0;
    for (Column inputColumn : inputSchema.getColumns()) {
        String name = inputColumn.getName();
        Type   type = inputColumn.getType();
        ColumnConfig columnConfig = getColumnConfig(name, columnConfigs);
        if (columnConfig != null) {
            type = columnConfig.getType();
        }
        Column outputColumn = new Column(i++, name, type);
        builder.add(outputColumn);
    }
    return new Schema(builder.build());
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:18,代码来源:TypecastFilterPlugin.java

示例6: buildOutputSchema

import org.embulk.spi.Schema; //导入方法依赖的package包/类
/**
 * @param inputSchema
 * @param task
 * @return
 */
private Schema buildOutputSchema(PluginTask task, Schema inputSchema) {
    ImmutableList.Builder<Column> builder = ImmutableList.builder();
    int i = 0;
    if (task.getKeepInput()) {
        for (Column inputColumn: inputSchema.getColumns()) {
            Column outputColumn = new Column(i++, inputColumn.getName(), inputColumn.getType());
            builder.add(outputColumn);
        }
    }

    for (String key: task.getKeyNames()) {
        for (Map<String, String> setting : task.getSettings()) {
            String keyName = key + MoreObjects.firstNonNull(setting.get("suffix"), "");
            if (task.getKeepInput()) {
                if (setting.get("suffix") != null) {
                    builder.add(new Column(i++, keyName, Types.STRING));
                }
            } else {
                builder.add(new Column(i++, keyName, Types.STRING));
            }
        }
    }
    Schema outputSchema = new Schema(builder.build());
    return outputSchema;
}
 
开发者ID:toyama0919,项目名称:embulk-filter-icu4j,代码行数:31,代码来源:Icu4jFilterPlugin.java

示例7: buildOutputSchema

import org.embulk.spi.Schema; //导入方法依赖的package包/类
/**
 * @param task
 * @param inputSchema
 * @return
 */
private Schema buildOutputSchema(PluginTask task, Schema inputSchema) {
    ImmutableList.Builder<Column> builder = ImmutableList.builder();
    int i = 0;
    for (Column inputColumn: inputSchema.getColumns()) {
        Column outputColumn = new Column(i++, inputColumn.getName(), inputColumn.getType());
        builder.add(outputColumn);
    }
    if (task.getMergeAgentInfo()) {
        builder.add(new Column(i++, task.getOutKeyOs(), Types.STRING));
        builder.add(new Column(i++, task.getOutKeyName(), Types.STRING));
        builder.add(new Column(i++, task.getOutKeyCategory(), Types.STRING));
        builder.add(new Column(i++, task.getOutKeyVersion(), Types.STRING));
        builder.add(new Column(i++, task.getOutKeyVendor(), Types.STRING));
    }
    Schema outputSchema = new Schema(builder.build());
    return outputSchema;
}
 
开发者ID:toyama0919,项目名称:embulk-filter-woothee,代码行数:23,代码来源:WootheeFilterPlugin.java

示例8: WootheePageOutput

import org.embulk.spi.Schema; //导入方法依赖的package包/类
public WootheePageOutput(TaskSource taskSource, Schema inputSchema, Schema outputSchema, PageOutput output) {
    this.task = taskSource.loadTask(PluginTask.class);
    this.outputColumns = outputSchema.getColumns();
    this.inputColumns = inputSchema.getColumns();
    Map<String, Column> inputColumnMap = Maps.newHashMap();
    this.wootheeColumnMap = Maps.newHashMap();
    for (Column column : outputColumns) {
        if (!inputColumns.contains(column)) {
            wootheeColumnMap.put(column.getName(), column);
        } else {
            inputColumnMap.put(column.getName(), column);
        }
    }
    this.reader = new PageReader(inputSchema);
    this.builder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
    this.keyNameColumn = inputColumnMap.get(task.getKeyName());
}
 
开发者ID:toyama0919,项目名称:embulk-filter-woothee,代码行数:18,代码来源:WootheePageOutput.java

示例9: initializeExpandedColumns

import org.embulk.spi.Schema; //导入方法依赖的package包/类
private List<ExpandedColumn> initializeExpandedColumns(PluginTask task,
                                                       Schema outputSchema)
{
    ImmutableList.Builder<ExpandedColumn> expandedJsonColumnsBuilder = ImmutableList.builder();
    for (Column outputColumn : outputSchema.getColumns()) {
        for (ColumnConfig expandedColumnConfig : task.getExpandedColumns()) {
            if (outputColumn.getName().equals(expandedColumnConfig.getName())) {

                TimestampParser timestampParser = null;
                if (Types.TIMESTAMP.equals(expandedColumnConfig.getType())) {
                    timestampParser = createTimestampParser(task, expandedColumnConfig);
                }

                ExpandedColumn expandedColumn = new ExpandedColumn(outputColumn.getName(),
                                                                   outputColumn,
                                                                   task.getRoot() + outputColumn.getName(),
                                                                   Optional.fromNullable(timestampParser));
                expandedJsonColumnsBuilder.add(expandedColumn);
            }
        }
    }
    return expandedJsonColumnsBuilder.build();
}
 
开发者ID:civitaspo,项目名称:embulk-filter-expand_json,代码行数:24,代码来源:FilteredPageOutput.java

示例10: initializeUnchangedColumns

import org.embulk.spi.Schema; //导入方法依赖的package包/类
private List<UnchangedColumn> initializeUnchangedColumns(Schema inputSchema,
                                                         Schema outputSchema,
                                                         Column excludeColumn)
{
    ImmutableList.Builder<UnchangedColumn> unchangedColumnsBuilder = ImmutableList.builder();
    for (Column outputColumn : outputSchema.getColumns()) {
        for (Column inputColumn : inputSchema.getColumns()) {
            if (inputColumn.getName().equals(outputColumn.getName()) &&
                    (!excludeColumn.getName().equals(outputColumn.getName()) || keepExpandingJsonColumn)) {

                UnchangedColumn unchangedColumn = new UnchangedColumn(outputColumn.getName(),
                                                                      inputColumn,
                                                                      outputColumn);
                unchangedColumnsBuilder.add(unchangedColumn);
            }
        }
    }
    return unchangedColumnsBuilder.build();
}
 
开发者ID:civitaspo,项目名称:embulk-filter-expand_json,代码行数:20,代码来源:FilteredPageOutput.java

示例11: initializeColumnBean

import org.embulk.spi.Schema; //导入方法依赖的package包/类
private void initializeColumnBean(PluginTask task, Schema schema) {
	List<ColumnConfig> list = task.getColumns().getColumns();

	Map<String, ColumnOptionTask> map = new HashMap<>();
	List<SheetCommonOptionTask> slist = getSheetOption();
	for (int i = slist.size() - 1; i >= 0; i--) {
		SheetCommonOptionTask s = slist.get(i);
		if (s instanceof SheetOptionTask) {
			Optional<Map<String, ColumnOptionTask>> option = ((SheetOptionTask) s).getColumns();
			if (option.isPresent()) {
				map.putAll(option.get());
			}
		}
	}

	for (Column column : schema.getColumns()) {
		String name = column.getName();
		ColumnConfig c = list.get(column.getIndex());
		ColumnOptionTask t = c.getOption().loadConfig(ColumnOptionTask.class);
		PoiExcelColumnBean bean = new PoiExcelColumnBean(this, column, t, map.get(name));
		columnBeanList.add(bean);
	}

	new PoiExcelColumnIndex().initializeColumnIndex(task, columnBeanList);
}
 
开发者ID:hishidama,项目名称:embulk-parser-poi_excel,代码行数:26,代码来源:PoiExcelSheetBean.java

示例12: buildOutputSchema

import org.embulk.spi.Schema; //导入方法依赖的package包/类
private Schema buildOutputSchema(Schema inputSchema, List<ColumnConfig> columns, String joinedColumnPrefix)
{
    ImmutableList.Builder<Column> builder = ImmutableList.builder();

    int i = 0; // columns index
    for (Column inputColumn: inputSchema.getColumns()) {
        Column outputColumn = new Column(i++, inputColumn.getName(), inputColumn.getType());
        builder.add(outputColumn);
    }
    for (ColumnConfig columnConfig: columns) {
        String columnName = joinedColumnPrefix + columnConfig.getName();
        builder.add(new Column(i++, columnName, columnConfig.getType()));
    }

    return new Schema(builder.build());
}
 
开发者ID:civitaspo,项目名称:embulk-filter-join_file,代码行数:17,代码来源:JoinFileFilterPlugin.java

示例13: buildOutputSchema

import org.embulk.spi.Schema; //导入方法依赖的package包/类
/**
 * @param task
 * @param inputSchema
 * @return
 */
private Schema buildOutputSchema(PluginTask task, Schema inputSchema) {
    ImmutableList.Builder<Column> builder = ImmutableList.builder();
    int i = 0;
    for (Column inputColumn: inputSchema.getColumns()) {
        Column outputColumn = new Column(i++, inputColumn.getName(), inputColumn.getType());
        builder.add(outputColumn);
    }
    for (String keyName : task.getKeyNames()) {
        builder.add(new Column(i++, keyName + task.getOutKeyNameSuffix(), Types.STRING));
    }
    Schema outputSchema = new Schema(builder.build());
    return outputSchema;
}
 
开发者ID:toyama0919,项目名称:embulk-filter-google_translate_api,代码行数:19,代码来源:GoogleTranslateApiFilterPlugin.java

示例14: GoogleTranslateApiPageOutput

import org.embulk.spi.Schema; //导入方法依赖的package包/类
public GoogleTranslateApiPageOutput(TaskSource taskSource, Schema inputSchema, Schema outputSchema, PageOutput output) {
    this.task = taskSource.loadTask(PluginTask.class);
    this.outputSchema = outputSchema;
    this.inputColumns = inputSchema.getColumns();
    this.reader = new PageReader(inputSchema);
    this.builder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
    this.keyNameColumns = Lists.newArrayList();
    for (String keyName : task.getKeyNames()) {
        this.keyNameColumns.add(outputSchema.lookupColumn(keyName));
    }
    this.translate = createTranslateService();

    this.srcLang = task.getSourceLang().isPresent() ? TranslateOption.sourceLanguage(task.getSourceLang().get()) : null;
    this.model = task.getModel().isPresent() ? TranslateOption.model(task.getModel().get()) : null;
}
 
开发者ID:toyama0919,项目名称:embulk-filter-google_translate_api,代码行数:16,代码来源:GoogleTranslateApiPageOutput.java

示例15: setColumnNameValues

import org.embulk.spi.Schema; //导入方法依赖的package包/类
private void setColumnNameValues(Schema schema)
{
    ImmutableMap.Builder<String, Value> builder = ImmutableMap.builder();
    for (Column column : schema.getColumns()) {
        String name = column.getName();
        builder.put(name, newString(name));
    }
    columnNameValues = builder.build();
}
 
开发者ID:shun0102,项目名称:embulk-parser-jsonl,代码行数:10,代码来源:JsonlParserPlugin.java


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