Package org.apache.iceberg.avro
Class ValueReaders
java.lang.Object
org.apache.iceberg.avro.ValueReaders
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ValueReader
<Collection<T>> array
(ValueReader<T> elementReader) static <K,
V> ValueReader <Map<K, V>> arrayMap
(ValueReader<K> keyReader, ValueReader<V> valueReader) static ValueReader
<Boolean> booleans()
static List
<Pair<Integer, ValueReader<?>>> buildReadPlan
(Types.StructType expected, org.apache.avro.Schema record, List<ValueReader<?>> fieldReaders, Map<Integer, ?> idToConstant) Builds a read plan for record classes that use planned reads instead of a ResolvingDecoder.static ValueReader
<ByteBuffer> static ValueReader
<byte[]> bytes()
static <T> ValueReader
<T> constant
(T value) static ValueReader
<BigDecimal> decimal
(ValueReader<byte[]> unscaledReader, int scale) static ValueReader
<byte[]> decimalBytesReader
(org.apache.avro.Schema schema) static ValueReader
<Double> doubles()
static ValueReader
<String> static ValueReader
<byte[]> fixed
(int length) static ValueReader
<org.apache.avro.generic.GenericData.Fixed> fixed
(org.apache.avro.Schema schema) static ValueReader
<Float> floats()
static ValueReader
<Double> static ValueReader
<Integer> ints()
static ValueReader
<Long> static ValueReader
<Long> longs()
static <K,
V> ValueReader <Map<K, V>> map
(ValueReader<K> keyReader, ValueReader<V> valueReader) static ValueReader
<Object> nulls()
static ValueReader
<Long> static <R extends org.apache.avro.generic.IndexedRecord>
ValueReader<R> record
(List<ValueReader<?>> readers, Class<R> recordClass, org.apache.avro.Schema recordSchema) static ValueReader
<org.apache.avro.generic.GenericData.Record> record
(List<ValueReader<?>> readers, org.apache.avro.Schema recordSchema) static <R extends org.apache.avro.generic.IndexedRecord>
ValueReader<R> record
(org.apache.avro.Schema recordSchema, Class<R> recordClass, List<Pair<Integer, ValueReader<?>>> readPlan) static ValueReader
<?> record
(org.apache.avro.Schema recordSchema, List<Pair<Integer, ValueReader<?>>> readPlan) static <T> ValueReader
<T> replaceWithConstant
(ValueReader<?> reader, T value) static ValueReader
<Void> skipStruct
(List<ValueReader<?>> readers) static ValueReader
<String> strings()
static ValueReader
<Object> union
(List<ValueReader<?>> readers) static ValueReader
<org.apache.avro.util.Utf8> utf8s()
static ValueReader
<UUID> uuids()
-
Method Details
-
nulls
-
constant
-
replaceWithConstant
-
booleans
-
ints
-
intsAsLongs
-
longs
-
floats
-
floatsAsDoubles
-
doubles
-
strings
-
utf8s
-
enums
-
uuids
-
fixed
-
fixed
public static ValueReader<org.apache.avro.generic.GenericData.Fixed> fixed(org.apache.avro.Schema schema) -
bytes
-
byteBuffers
-
decimal
-
decimalBytesReader
-
union
-
positions
-
array
-
arrayMap
public static <K,V> ValueReader<Map<K,V>> arrayMap(ValueReader<K> keyReader, ValueReader<V> valueReader) -
map
public static <K,V> ValueReader<Map<K,V>> map(ValueReader<K> keyReader, ValueReader<V> valueReader) -
record
public static ValueReader<org.apache.avro.generic.GenericData.Record> record(List<ValueReader<?>> readers, org.apache.avro.Schema recordSchema) -
record
public static <R extends org.apache.avro.generic.IndexedRecord> ValueReader<R> record(List<ValueReader<?>> readers, Class<R> recordClass, org.apache.avro.Schema recordSchema) -
record
public static ValueReader<?> record(org.apache.avro.Schema recordSchema, List<Pair<Integer, ValueReader<?>>> readPlan) -
record
public static <R extends org.apache.avro.generic.IndexedRecord> ValueReader<R> record(org.apache.avro.Schema recordSchema, Class<R> recordClass, List<Pair<Integer, ValueReader<?>>> readPlan) -
skipStruct
-
buildReadPlan
public static List<Pair<Integer,ValueReader<?>>> buildReadPlan(Types.StructType expected, org.apache.avro.Schema record, List<ValueReader<?>> fieldReaders, Map<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
-