Search in sources :

Example 1 with VarDecimalWriter

use of org.apache.drill.exec.vector.complex.writer.VarDecimalWriter in project drill by apache.

the class DrillParquetGroupConverter method getVarDecimalConverter.

private PrimitiveConverter getVarDecimalConverter(String name, PrimitiveType type) {
    int scale = type.getDecimalMetadata().getScale();
    int precision = type.getDecimalMetadata().getPrecision();
    VarDecimalWriter writer = type.isRepetition(Repetition.REPEATED) ? getWriter(name, (m, f) -> m.list(f).varDecimal(precision, scale), l -> l.list().varDecimal(precision, scale)) : getWriter(name, (m, f) -> m.varDecimal(f, precision, scale), l -> l.varDecimal(precision, scale));
    return new DrillVarDecimalConverter(writer, precision, scale, mutator.getManagedBuffer());
}
Also used : IntervalHolder(org.apache.drill.exec.expr.holders.IntervalHolder) PrimitiveType(org.apache.parquet.schema.PrimitiveType) VarDecimalHolder(org.apache.drill.exec.expr.holders.VarDecimalHolder) SingleMapWriter(org.apache.drill.exec.vector.complex.impl.SingleMapWriter) BiFunction(java.util.function.BiFunction) VarCharHolder(org.apache.drill.exec.expr.holders.VarCharHolder) ParquetReaderUtility(org.apache.drill.exec.store.parquet.ParquetReaderUtility) OutputMutator(org.apache.drill.exec.physical.impl.OutputMutator) VarCharWriter(org.apache.drill.exec.vector.complex.writer.VarCharWriter) PathSegment(org.apache.drill.common.expression.PathSegment) TimeStampWriter(org.apache.drill.exec.vector.complex.writer.TimeStampWriter) PrimitiveConverter(org.apache.parquet.io.api.PrimitiveConverter) DateHolder(org.apache.drill.exec.expr.holders.DateHolder) DrillBuf(io.netty.buffer.DrillBuf) BigIntHolder(org.apache.drill.exec.expr.holders.BigIntHolder) VarBinaryWriter(org.apache.drill.exec.vector.complex.writer.VarBinaryWriter) BigIntWriter(org.apache.drill.exec.vector.complex.writer.BigIntWriter) AbstractRepeatedMapWriter(org.apache.drill.exec.vector.complex.impl.AbstractRepeatedMapWriter) IntWriter(org.apache.drill.exec.vector.complex.writer.IntWriter) GroupType(org.apache.parquet.schema.GroupType) GroupConverter(org.apache.parquet.io.api.GroupConverter) VarDecimalWriter(org.apache.drill.exec.vector.complex.writer.VarDecimalWriter) Collection(java.util.Collection) SchemaPath(org.apache.drill.common.expression.SchemaPath) Float4Writer(org.apache.drill.exec.vector.complex.writer.Float4Writer) TimeWriter(org.apache.drill.exec.vector.complex.writer.TimeWriter) BaseWriter(org.apache.drill.exec.vector.complex.writer.BaseWriter) MapWriter(org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter) Binary(org.apache.parquet.io.api.Binary) Longs(org.apache.drill.shaded.guava.com.google.common.primitives.Longs) List(java.util.List) DYNAMIC_STAR(org.apache.drill.common.expression.SchemaPath.DYNAMIC_STAR) Optional(java.util.Optional) Type(org.apache.parquet.schema.Type) ExecConstants(org.apache.drill.exec.ExecConstants) DateWriter(org.apache.drill.exec.vector.complex.writer.DateWriter) BitHolder(org.apache.drill.exec.expr.holders.BitHolder) OptionManager(org.apache.drill.exec.server.options.OptionManager) Ints(org.apache.drill.shaded.guava.com.google.common.primitives.Ints) BitWriter(org.apache.drill.exec.vector.complex.writer.BitWriter) Float8Writer(org.apache.drill.exec.vector.complex.writer.Float8Writer) Converter(org.apache.parquet.io.api.Converter) ListWriter(org.apache.drill.exec.vector.complex.writer.BaseWriter.ListWriter) Repetition(org.apache.parquet.schema.Type.Repetition) DrillRuntimeException(org.apache.drill.common.exceptions.DrillRuntimeException) LogicalTypeAnnotation(org.apache.parquet.schema.LogicalTypeAnnotation) Function(java.util.function.Function) Supplier(java.util.function.Supplier) Float8Holder(org.apache.drill.exec.expr.holders.Float8Holder) VarBinaryHolder(org.apache.drill.exec.expr.holders.VarBinaryHolder) ArrayList(java.util.ArrayList) Float4Holder(org.apache.drill.exec.expr.holders.Float4Holder) NanoTimeUtils.getDateTimeValueFromBinary(org.apache.drill.exec.store.parquet.ParquetReaderUtility.NanoTimeUtils.getDateTimeValueFromBinary) TimeHolder(org.apache.drill.exec.expr.holders.TimeHolder) IntHolder(org.apache.drill.exec.expr.holders.IntHolder) DictWriter(org.apache.drill.exec.vector.complex.writer.BaseWriter.DictWriter) Iterator(java.util.Iterator) IntervalWriter(org.apache.drill.exec.vector.complex.writer.IntervalWriter) ParquetColumnMetadata(org.apache.drill.exec.store.parquet.columnreaders.ParquetColumnMetadata) Collections(java.util.Collections) TimeStampHolder(org.apache.drill.exec.expr.holders.TimeStampHolder) DateTimeConstants(org.joda.time.DateTimeConstants) VarDecimalWriter(org.apache.drill.exec.vector.complex.writer.VarDecimalWriter)

Aggregations

DrillBuf (io.netty.buffer.DrillBuf)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Optional (java.util.Optional)1 BiFunction (java.util.function.BiFunction)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1 DrillRuntimeException (org.apache.drill.common.exceptions.DrillRuntimeException)1 PathSegment (org.apache.drill.common.expression.PathSegment)1 SchemaPath (org.apache.drill.common.expression.SchemaPath)1 DYNAMIC_STAR (org.apache.drill.common.expression.SchemaPath.DYNAMIC_STAR)1 ExecConstants (org.apache.drill.exec.ExecConstants)1 BigIntHolder (org.apache.drill.exec.expr.holders.BigIntHolder)1 BitHolder (org.apache.drill.exec.expr.holders.BitHolder)1 DateHolder (org.apache.drill.exec.expr.holders.DateHolder)1 Float4Holder (org.apache.drill.exec.expr.holders.Float4Holder)1 Float8Holder (org.apache.drill.exec.expr.holders.Float8Holder)1