Sha256: 8964f828ce64800f7457d82356ac5c43e79fcb8f28847775076e556602b82168

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

package org.embulk.parser.avro.getter;

import org.embulk.spi.Column;
import org.embulk.spi.PageBuilder;
import org.embulk.spi.time.Timestamp;
import org.embulk.spi.time.TimestampParser;

public class LongColumnGetter extends BaseColumnGetter {
    protected Long value;

    public LongColumnGetter(PageBuilder pageBuilder, TimestampParser[] timestampParsers) {
        super(pageBuilder, timestampParsers);
    }

    @Override
    public void setValue(Object value)
    {
        this.value = (Long) value;
    }

    @Override
    public void longColumn(Column column) {
        if (value == null) {
            pageBuilder.setNull(column);
        } else {
            pageBuilder.setLong(column, value);
        }
    }

    @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 {
            Long casted = (Long) value;
            pageBuilder.setString(column, value.toString());
        }
    }

    @Override
    public void timestampColumn(Column column) {
        if (this.value == null) {
            pageBuilder.setNull(column);
        }
        else {
            pageBuilder.setTimestamp(column, Timestamp.ofEpochSecond(value));
        }
    }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-parser-avro-0.2.0 src/main/java/org/embulk/parser/avro/getter/LongColumnGetter.java
embulk-parser-avro-0.1.0 src/main/java/org/embulk/parser/avro/getter/LongColumnGetter.java