Sha256: 100b3dacaed1b3ad653ff2430d77841e3b62c418737d191e274d31c3445d58c2

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

package org.embulk.filter.calcite.adapter.page;

import org.apache.calcite.adapter.java.JavaTypeFactory;
import org.apache.calcite.rel.type.RelDataType;

import java.util.HashMap;
import java.util.Map;

enum PageFieldType
{
    STRING(String.class, "string"),
    BOOLEAN(Boolean.class, Boolean.TYPE.getSimpleName()),
    LONG(Long.class, Long.TYPE.getSimpleName()),
    DOUBLE(Double.class, Double.TYPE.getSimpleName()),
    TIMESTAMP(java.sql.Timestamp.class, "timestamp");

    private static final Map<String, PageFieldType> MAP = new HashMap<>();

    static
    {
        for (PageFieldType value : values()) {
            MAP.put(value.simpleName, value);
        }
    }

    private final Class clazz;
    private final String simpleName;

    private PageFieldType(Class clazz, String simpleName)
    {
        this.clazz = clazz;
        this.simpleName = simpleName;
    }

    public RelDataType toType(JavaTypeFactory typeFactory)
    {
        return typeFactory.createJavaType(clazz);
    }

    public static PageFieldType of(String typeString)
    {
        return MAP.get(typeString);
    }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-filter-calcite-0.1.1 src/main/java/org/embulk/filter/calcite/adapter/page/PageFieldType.java
embulk-filter-calcite-0.1.0 src/main/java/org/embulk/filter/calcite/adapter/page/PageFieldType.java