Sha256: 4278feb2771869cbdcd77679a9b4083d2f96763610cdd9e8074bb8f03d36ee62
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
package org.embulk.parser.avro.getter; import org.embulk.parser.avro.TimestampUnit; import org.embulk.spi.Column; import org.embulk.spi.PageBuilder; import org.embulk.spi.time.TimestampParser; public class FloatColumnGetter extends BaseColumnGetter { protected Float value; private final TimestampUnit[] timestampUnits; public FloatColumnGetter(PageBuilder pageBuilder, TimestampParser[] timestampParsers, TimestampUnit[] timestampUnits) { super(pageBuilder, timestampParsers); this.timestampUnits = timestampUnits; } @Override public void setValue(Object value) { this.value = (Float) value; } @Override public void longColumn(Column column) { if (value == null) { pageBuilder.setNull(column); } else { pageBuilder.setLong(column, value.longValue()); } } @Override public void doubleColumn(Column column) { if (value == null) { pageBuilder.setNull(column); } else { pageBuilder.setDouble(column, value.doubleValue()); } } @Override public void stringColumn(Column column) { if (value == null) { pageBuilder.setNull(column); } else { pageBuilder.setString(column, value.toString()); } } @Override public void timestampColumn(Column column) { if (this.value == null) { pageBuilder.setNull(column); } else { TimestampUnit unit = timestampUnits[column.getIndex()]; pageBuilder.setTimestamp(column, unit.toTimestamp(value.doubleValue())); } } }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
embulk-parser-avro-0.4.0 | src/main/java/org/embulk/parser/avro/getter/FloatColumnGetter.java |
embulk-parser-avro-0.3.0 | src/main/java/org/embulk/parser/avro/getter/FloatColumnGetter.java |