Class ValueReaders


  • public class ValueReaders
    extends java.lang.Object
    • Method Detail

      • nulls

        public static ValueReader<java.lang.Object> nulls()
      • constant

        public static <T> ValueReader<T> constant​(T value)
      • replaceWithConstant

        public static <T> ValueReader<T> replaceWithConstant​(ValueReader<?> reader,
                                                             T value)
      • booleans

        public static ValueReader<java.lang.Boolean> booleans()
      • ints

        public static ValueReader<java.lang.Integer> ints()
      • intsAsLongs

        public static ValueReader<java.lang.Long> intsAsLongs()
      • longs

        public static ValueReader<java.lang.Long> longs()
      • floats

        public static ValueReader<java.lang.Float> floats()
      • floatsAsDoubles

        public static ValueReader<java.lang.Double> floatsAsDoubles()
      • doubles

        public static ValueReader<java.lang.Double> doubles()
      • strings

        public static ValueReader<java.lang.String> strings()
      • utf8s

        public static ValueReader<org.apache.avro.util.Utf8> utf8s()
      • enums

        public static ValueReader<java.lang.String> enums​(java.util.List<java.lang.String> symbols)
      • uuids

        public static ValueReader<java.util.UUID> uuids()
      • fixed

        public static ValueReader<byte[]> fixed​(int length)
      • fixed

        public static ValueReader<org.apache.avro.generic.GenericData.Fixed> fixed​(org.apache.avro.Schema schema)
      • byteBuffers

        public static ValueReader<java.nio.ByteBuffer> byteBuffers()
      • decimal

        public static ValueReader<java.math.BigDecimal> decimal​(ValueReader<byte[]> unscaledReader,
                                                                int scale)
      • decimalBytesReader

        public static ValueReader<byte[]> decimalBytesReader​(org.apache.avro.Schema schema)
      • positions

        public static ValueReader<java.lang.Long> positions()
      • record

        public static ValueReader<org.apache.avro.generic.GenericData.Record> record​(java.util.List<ValueReader<?>> readers,
                                                                                     org.apache.avro.Schema recordSchema)
      • record

        public static <R extends org.apache.avro.generic.IndexedRecord> ValueReader<R> record​(java.util.List<ValueReader<?>> readers,
                                                                                              java.lang.Class<R> recordClass,
                                                                                              org.apache.avro.Schema recordSchema)
      • record

        public static ValueReader<?> record​(org.apache.avro.Schema recordSchema,
                                            java.util.List<Pair<java.lang.Integer,​ValueReader<?>>> readPlan)
      • record

        public static <R extends org.apache.avro.generic.IndexedRecord> ValueReader<R> record​(org.apache.avro.Schema recordSchema,
                                                                                              java.lang.Class<R> recordClass,
                                                                                              java.util.List<Pair<java.lang.Integer,​ValueReader<?>>> readPlan)
      • skipStruct

        public static ValueReader<java.lang.Void> skipStruct​(java.util.List<ValueReader<?>> readers)
      • buildReadPlan

        public static java.util.List<Pair<java.lang.Integer,​ValueReader<?>>> buildReadPlan​(Types.StructType expected,
                                                                                                 org.apache.avro.Schema record,
                                                                                                 java.util.List<ValueReader<?>> fieldReaders,
                                                                                                 java.util.Map<java.lang.Integer,​?> idToConstant)
        Builds a read plan for record classes that use planned reads instead of a ResolvingDecoder.
        Parameters:
        expected - expected StructType
        record - Avro record schema
        fieldReaders - list of readers for each field in the Avro record schema
        idToConstant - a map of field ID to constants values
        Returns:
        a read plan that is a list of (position, reader) pairs