diff --git a/core/src/main/java/org/apache/iceberg/avro/ValueReaders.java b/core/src/main/java/org/apache/iceberg/avro/ValueReaders.java index c3d4369c48ff..d530bc1854e1 100644 --- a/core/src/main/java/org/apache/iceberg/avro/ValueReaders.java +++ b/core/src/main/java/org/apache/iceberg/avro/ValueReaders.java @@ -143,10 +143,6 @@ public static ValueReader union(List> readers) { return new UnionReader(readers); } - public static ValueReader optionalAsRequired(List> readers, String name) { - return new RequiredOptionReader(name, readers); - } - public static ValueReader positions() { return new PositionReader(); } @@ -557,40 +553,6 @@ public void skip(Decoder decoder) throws IOException { } } - private static class RequiredOptionReader implements ValueReader { - private final String name; - private final ValueReader[] readers; - - private RequiredOptionReader(String name, List> readers) { - this.name = name; - this.readers = new ValueReader[readers.size()]; - for (int i = 0; i < this.readers.length; i += 1) { - this.readers[i] = readers.get(i); - } - } - - @Override - public Object read(Decoder decoder, Object reuse) throws IOException { - int index = decoder.readIndex(); - return checkNonNull(readers[index].read(decoder, reuse)); - } - - @Override - public void skip(Decoder decoder) throws IOException { - int index = decoder.readIndex(); - readers[index].skip(decoder); - } - - private Object checkNonNull(Object value) { - if (null == value) { - throw new NullPointerException( - String.format("Read a null value in required field: %s", name)); - } - - return value; - } - } - private static class UnionReader implements ValueReader { private final ValueReader[] readers;