本文整理汇总了Java中org.embulk.spi.Column.getIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Column.getIndex方法的具体用法?Java Column.getIndex怎么用?Java Column.getIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.embulk.spi.Column
的用法示例。
在下文中一共展示了Column.getIndex方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: longColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void longColumn(Column column)
{
if (isNil(value)) {
pageBuilder.setNull(column);
}
else {
try {
long longValue = autoTypecasts[column.getIndex()] ? ColumnCaster.asLong(newInteger(value.asLong())) : value.asLong();
pageBuilder.setLong(column, longValue);
}
catch (MessageTypeException e) {
throw new JsonRecordValidateException(format("failed to get \"%s\" as Long", value), e);
}
}
}
示例2: doubleColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void doubleColumn(Column column)
{
if (isNil(value)) {
pageBuilder.setNull(column);
}
else {
try {
double doubleValue = autoTypecasts[column.getIndex()] ? ColumnCaster.asDouble(newFloat(value.asDouble())) : value.asDouble();
pageBuilder.setDouble(column, doubleValue);
}
catch (MessageTypeException e) {
throw new JsonRecordValidateException(format("failed get \"%s\" as Double", value), e);
}
}
}
示例3: stringColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void stringColumn(Column column)
{
if (isNil(value)) {
pageBuilder.setNull(column);
}
else {
final String stringValue = valueAsString();
try {
String string = autoTypecasts[column.getIndex()] ? ColumnCaster.asString(newString(stringValue)) : stringValue;
pageBuilder.setString(column, string);
}
catch (MessageTypeException e) {
throw new JsonRecordValidateException(format("failed to get \"%s\" as String", value), e);
}
}
}
示例4: booleanColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void booleanColumn(Column column) {
if (pageReader.isNull(column))
return;
AbstractAvroValueConverter converter = avroValueConverters[column.getIndex()];
if (converter == null)
return;
Boolean value = pageReader.getBoolean(column);
Object result = converter.booleanColumn(value);
record.put(column.getName(), result);
}
示例5: longColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void longColumn(Column column) {
if (pageReader.isNull(column))
return;
AbstractAvroValueConverter converter = avroValueConverters[column.getIndex()];
if (converter == null)
return;
Long value = pageReader.getLong(column);
Object result = converter.longColumn(value);
record.put(column.getName(), result);
}
示例6: doubleColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void doubleColumn(Column column) {
if (pageReader.isNull(column))
return;
AbstractAvroValueConverter converter = avroValueConverters[column.getIndex()];
if (converter == null)
return;
Double value = pageReader.getDouble(column);
Object result = converter.doubleColumn(value);
record.put(column.getName(), result);
}
示例7: stringColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void stringColumn(Column column) {
if (pageReader.isNull(column))
return;
AbstractAvroValueConverter converter = avroValueConverters[column.getIndex()];
if (converter == null)
return;
String value = pageReader.getString(column);
Object result = converter.stringColumn(value);
record.put(column.getName(), result);
}
示例8: timestampColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void timestampColumn(Column column) {
if (pageReader.isNull(column))
return;
AbstractAvroValueConverter converter = avroValueConverters[column.getIndex()];
if (converter == null)
return;
Timestamp value = pageReader.getTimestamp(column);
String formatted = timestampFormatters[column.getIndex()].format(value);
Object result = converter.timestampColumn(formatted);
record.put(column.getName(), result);
}
示例9: jsonColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void jsonColumn(Column column) {
if (pageReader.isNull(column))
return;
AbstractAvroValueConverter converter = avroValueConverters[column.getIndex()];
if (converter == null)
return;
Value value = pageReader.getJson(column);
Object result = converter.jsonColumn(value);
record.put(column.getName(), result);
}
示例10: timestampColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void timestampColumn(Column column) {
Value columnName = ValueFactory.newString(column.getName());
TimestampFormatter formatter = timestampFormatters[column.getIndex()];
Value value = ValueFactory.newString(formatter.format(reader.getTimestamp(column)));
builder.put(columnName, value);
}
示例11: timestampColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void timestampColumn(Column column) {
Timestamp value = reader.getTimestamp(column);
TimestampFormatter formatter = timestampFormatters[column.getIndex()];
try {
packer.packString(formatter.format(value));
} catch (IOException e) {
throw new RuntimeException("cannot write to msgpack");
}
}
示例12: timestampColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void timestampColumn(Column column) {
if (this.value == null) {
pageBuilder.setNull(column);
}
else {
TimestampParser parser = timestampParsers[column.getIndex()];
pageBuilder.setTimestamp(column, parser.parse(value));
}
}
示例13: booleanColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void booleanColumn(Column column)
{
if (isNil(value)) {
pageBuilder.setNull(column);
return;
}
final boolean val;
if (value.isBoolean()) {
val = value.asBoolean();
}
else {
String stringValue = valueAsString().toLowerCase();
if (BOOL_TRUE_STRINGS.contains(stringValue)) {
val = true;
}
else if (BOOL_FALSE_STRINGS.contains(stringValue)) {
val = false;
}
else {
throw new JsonRecordValidateException(format("can not convert '%s' to Boolean", value));
}
}
try {
boolean booleanValue = autoTypecasts[column.getIndex()] ? ColumnCaster.asBoolean(newBoolean(val)) : val;
pageBuilder.setBoolean(column, booleanValue);
}
catch (MessageTypeException e) {
throw new JsonRecordValidateException(format("failed to get \"%s\" as Boolean", value), e);
}
}
示例14: timestampColumn
import org.embulk.spi.Column; //导入方法依赖的package包/类
@Override
public void timestampColumn(Column column) {
Timestamp value = reader.getTimestamp(column);
TimestampFormatter formatter = timestampFormatters[column.getIndex()];
sb.append(ValueFactory.newString(formatter.format(value)).toJson());
}