本文整理汇总了Java中org.embulk.spi.Column.getType方法的典型用法代码示例。如果您正苦于以下问题:Java Column.getType方法的具体用法?Java Column.getType怎么用?Java Column.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.embulk.spi.Column
的用法示例。
在下文中一共展示了Column.getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFromBoolean
import org.embulk.spi.Column; //导入方法依赖的package包/类
public void setFromBoolean(Column outputColumn, boolean value)
{
Type outputType = outputColumn.getType();
if (outputType instanceof BooleanType) {
pageBuilder.setBoolean(outputColumn, BooleanCast.asBoolean(value));
}
else if (outputType instanceof LongType) {
pageBuilder.setLong(outputColumn, BooleanCast.asLong(value));
}
else if (outputType instanceof DoubleType) {
pageBuilder.setDouble(outputColumn, BooleanCast.asDouble(value));
}
else if (outputType instanceof StringType) {
pageBuilder.setString(outputColumn, BooleanCast.asString(value));
}
else if (outputType instanceof TimestampType) {
pageBuilder.setTimestamp(outputColumn, BooleanCast.asTimestamp(value));
}
else if (outputType instanceof JsonType) {
pageBuilder.setJson(outputColumn, BooleanCast.asJson(value));
}
else {
assert (false);
}
}
示例2: buildOuputSchema
import org.embulk.spi.Column; //导入方法依赖的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());
}
示例3: buildOutputSchema
import org.embulk.spi.Column; //导入方法依赖的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
示例4: visitReferenceValue
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public Value visitReferenceValue(JSONParser.ReferenceValueContext ctx)
{
JSONParser.ReferenceContext ref = ctx.reference();
String key = ref.ID().getText();
Column column = inputSchema.lookupColumn(key);
Value value;
Type column_type = column.getType();
if (pageReader.isNull(column)){
value = ValueFactory.newNil();
}
else if (column_type == Types.BOOLEAN) {
value = ValueFactory.newBoolean(pageReader.getBoolean(column));
}
else if (column_type == Types.DOUBLE) {
value = ValueFactory.newFloat(pageReader.getDouble(column));
}
else if (column_type == Types.STRING) {
value = ValueFactory.newString(pageReader.getString(column));
}
else if (column_type == Types.LONG) {
value = ValueFactory.newInteger(pageReader.getLong(column));
}
else if (column_type == Types.JSON) {
value = pageReader.getJson(column);
}
else {
// Unsupported type;
value = ValueFactory.newNil();
}
return value;
}
示例5: buildTimestampParserMap
import org.embulk.spi.Column; //导入方法依赖的package包/类
private void buildTimestampParserMap()
{
// columnName => TimestampParser
for (ColumnConfig columnConfig : task.getColumns()) {
if (PathCompiler.isProbablyJsonPath(columnConfig.getName())) {
continue; // type: json columns do not support type: timestamp
}
Column inputColumn = inputSchema.lookupColumn(columnConfig.getName());
if (inputColumn.getType() instanceof StringType && columnConfig.getType() instanceof TimestampType) {
TimestampParser parser = createTimestampParser(task, columnConfig);
this.timestampParserMap.put(columnConfig.getName(), parser);
}
}
}
示例6: buildTimestampFormatterMap
import org.embulk.spi.Column; //导入方法依赖的package包/类
private void buildTimestampFormatterMap()
{
// columnName => TimestampFormatter
for (ColumnConfig columnConfig : task.getColumns()) {
if (PathCompiler.isProbablyJsonPath(columnConfig.getName())) {
continue; // type: json columns do not have type: timestamp
}
Column inputColumn = inputSchema.lookupColumn(columnConfig.getName());
if (inputColumn.getType() instanceof TimestampType && columnConfig.getType() instanceof StringType) {
TimestampFormatter parser = createTimestampFormatter(task, columnConfig);
this.timestampFormatterMap.put(columnConfig.getName(), parser);
}
}
}