Package org.apache.iceberg.avro
Class ValueReaders
- java.lang.Object
-
- org.apache.iceberg.avro.ValueReaders
-
public class ValueReaders extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ValueReaders.PlannedStructReader<S>
static class
ValueReaders.StructReader<S>
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> ValueReader<java.util.Collection<T>>
array(ValueReader<T> elementReader)
static <K,V>
ValueReader<java.util.Map<K,V>>arrayMap(ValueReader<K> keyReader, ValueReader<V> valueReader)
static ValueReader<java.lang.Boolean>
booleans()
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.static ValueReader<java.nio.ByteBuffer>
byteBuffers()
static ValueReader<byte[]>
bytes()
static <T> ValueReader<T>
constant(T value)
static ValueReader<java.math.BigDecimal>
decimal(ValueReader<byte[]> unscaledReader, int scale)
static ValueReader<byte[]>
decimalBytesReader(org.apache.avro.Schema schema)
static ValueReader<java.lang.Double>
doubles()
static ValueReader<java.lang.String>
enums(java.util.List<java.lang.String> symbols)
static ValueReader<byte[]>
fixed(int length)
static ValueReader<org.apache.avro.generic.GenericData.Fixed>
fixed(org.apache.avro.Schema schema)
static ValueReader<java.lang.Float>
floats()
static ValueReader<java.lang.Double>
floatsAsDoubles()
static ValueReader<java.lang.Integer>
ints()
static ValueReader<java.lang.Long>
intsAsLongs()
static ValueReader<java.lang.Long>
longs()
static <K,V>
ValueReader<java.util.Map<K,V>>map(ValueReader<K> keyReader, ValueReader<V> valueReader)
static ValueReader<java.lang.Object>
nulls()
static ValueReader<java.lang.Long>
positions()
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)
static ValueReader<org.apache.avro.generic.GenericData.Record>
record(java.util.List<ValueReader<?>> readers, org.apache.avro.Schema recordSchema)
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)
static ValueReader<?>
record(org.apache.avro.Schema recordSchema, java.util.List<Pair<java.lang.Integer,ValueReader<?>>> readPlan)
static <T> ValueReader<T>
replaceWithConstant(ValueReader<?> reader, T value)
static ValueReader<java.lang.Void>
skipStruct(java.util.List<ValueReader<?>> readers)
static ValueReader<java.lang.String>
strings()
static ValueReader<java.lang.Object>
union(java.util.List<ValueReader<?>> readers)
static ValueReader<org.apache.avro.util.Utf8>
utf8s()
static ValueReader<java.util.UUID>
uuids()
-
-
-
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)
-
bytes
public static ValueReader<byte[]> bytes()
-
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)
-
union
public static ValueReader<java.lang.Object> union(java.util.List<ValueReader<?>> readers)
-
positions
public static ValueReader<java.lang.Long> positions()
-
array
public static <T> ValueReader<java.util.Collection<T>> array(ValueReader<T> elementReader)
-
arrayMap
public static <K,V> ValueReader<java.util.Map<K,V>> arrayMap(ValueReader<K> keyReader, ValueReader<V> valueReader)
-
map
public static <K,V> ValueReader<java.util.Map<K,V>> map(ValueReader<K> keyReader, ValueReader<V> valueReader)
-
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 StructTyperecord
- Avro record schemafieldReaders
- list of readers for each field in the Avro record schemaidToConstant
- a map of field ID to constants values- Returns:
- a read plan that is a list of (position, reader) pairs
-
-