Search in sources :

Example 1 with Float8FieldWriter

use of com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.Float8FieldWriter in project aws-athena-query-federation by awslabs.

the class GeneratedRowWriter method makeFieldWriter.

private FieldWriter makeFieldWriter(FieldVector vector) {
    Field field = vector.getField();
    String fieldName = field.getName();
    Types.MinorType fieldType = Types.getMinorTypeForArrowType(field.getType());
    Extractor extractor = extractors.get(fieldName);
    ConstraintProjector constraint = constraints.get(fieldName);
    FieldWriterFactory factory = fieldWriterFactories.get(fieldName);
    if (factory != null) {
        return factory.create(vector, extractor, constraint);
    }
    if (extractor == null) {
        throw new IllegalStateException("Missing extractor for field[" + fieldName + "]");
    }
    switch(fieldType) {
        case INT:
            return new IntFieldWriter((IntExtractor) extractor, (IntVector) vector, constraint);
        case BIGINT:
            return new BigIntFieldWriter((BigIntExtractor) extractor, (BigIntVector) vector, constraint);
        case DATEMILLI:
            return new DateMilliFieldWriter((DateMilliExtractor) extractor, (DateMilliVector) vector, constraint);
        case DATEDAY:
            return new DateDayFieldWriter((DateDayExtractor) extractor, (DateDayVector) vector, constraint);
        case TINYINT:
            return new TinyIntFieldWriter((TinyIntExtractor) extractor, (TinyIntVector) vector, constraint);
        case SMALLINT:
            return new SmallIntFieldWriter((SmallIntExtractor) extractor, (SmallIntVector) vector, constraint);
        case FLOAT4:
            return new Float4FieldWriter((Float4Extractor) extractor, (Float4Vector) vector, constraint);
        case FLOAT8:
            return new Float8FieldWriter((Float8Extractor) extractor, (Float8Vector) vector, constraint);
        case DECIMAL:
            return new DecimalFieldWriter((DecimalExtractor) extractor, (DecimalVector) vector, constraint);
        case BIT:
            return new BitFieldWriter((BitExtractor) extractor, (BitVector) vector, constraint);
        case VARCHAR:
            return new VarCharFieldWriter((VarCharExtractor) extractor, (VarCharVector) vector, constraint);
        case VARBINARY:
            return new VarBinaryFieldWriter((VarBinaryExtractor) extractor, (VarBinaryVector) vector, constraint);
        default:
            throw new RuntimeException(fieldType + " is not supported");
    }
}
Also used : Types(org.apache.arrow.vector.types.Types) VarBinaryFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.VarBinaryFieldWriter) TinyIntFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.TinyIntFieldWriter) SmallIntFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.SmallIntFieldWriter) ConstraintProjector(com.amazonaws.athena.connector.lambda.domain.predicate.ConstraintProjector) DecimalFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.DecimalFieldWriter) BigIntFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.BigIntFieldWriter) FieldWriterFactory(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.FieldWriterFactory) BitFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.BitFieldWriter) DateMilliFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.DateMilliFieldWriter) DateDayFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.DateDayFieldWriter) VarCharFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.VarCharFieldWriter) Field(org.apache.arrow.vector.types.pojo.Field) IntFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.IntFieldWriter) TinyIntFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.TinyIntFieldWriter) BigIntFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.BigIntFieldWriter) SmallIntFieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.SmallIntFieldWriter) Float4FieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.Float4FieldWriter) Float8FieldWriter(com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.Float8FieldWriter) BigIntExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.BigIntExtractor) DecimalExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.DecimalExtractor) DateDayExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.DateDayExtractor) TinyIntExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.TinyIntExtractor) VarBinaryExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.VarBinaryExtractor) BitExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.BitExtractor) IntExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.IntExtractor) Extractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.Extractor) Float8Extractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.Float8Extractor) SmallIntExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.SmallIntExtractor) VarCharExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.VarCharExtractor) Float4Extractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.Float4Extractor) DateMilliExtractor(com.amazonaws.athena.connector.lambda.data.writers.extractors.DateMilliExtractor)

Aggregations

BigIntExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.BigIntExtractor)1 BitExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.BitExtractor)1 DateDayExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.DateDayExtractor)1 DateMilliExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.DateMilliExtractor)1 DecimalExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.DecimalExtractor)1 Extractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.Extractor)1 Float4Extractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.Float4Extractor)1 Float8Extractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.Float8Extractor)1 IntExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.IntExtractor)1 SmallIntExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.SmallIntExtractor)1 TinyIntExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.TinyIntExtractor)1 VarBinaryExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.VarBinaryExtractor)1 VarCharExtractor (com.amazonaws.athena.connector.lambda.data.writers.extractors.VarCharExtractor)1 BigIntFieldWriter (com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.BigIntFieldWriter)1 BitFieldWriter (com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.BitFieldWriter)1 DateDayFieldWriter (com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.DateDayFieldWriter)1 DateMilliFieldWriter (com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.DateMilliFieldWriter)1 DecimalFieldWriter (com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.DecimalFieldWriter)1 FieldWriterFactory (com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.FieldWriterFactory)1 Float4FieldWriter (com.amazonaws.athena.connector.lambda.data.writers.fieldwriters.Float4FieldWriter)1