This is an automated email from the ASF dual-hosted git repository. thiru pushed a commit to branch fast-decoder-thiru in repository https://gitbox.apache.org/repos/asf/avro.git
commit faf150c3dbe06447a1264c3ad8c5ed3f2e1ee848 Author: Thiruvalluvan M G <[email protected]> AuthorDate: Wed May 1 12:10:16 2019 -0700 Fixed documentation --- .../java/org/apache/avro/generic/Advancer.java | 84 +++++++++------------- .../apache/avro/generic/GenericDatumReader2.java | 1 - 2 files changed, 32 insertions(+), 53 deletions(-) diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/Advancer.java b/lang/java/avro/src/main/java/org/apache/avro/generic/Advancer.java index 0f48994..1fdac92 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/generic/Advancer.java +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/Advancer.java @@ -31,7 +31,7 @@ import org.apache.avro.util.Utf8; * An "Advancer" is a tree of objects that apply resolution logic while reading * values out of a {@link Decoder}. * - * An Advancer tree is created by calling {@link advancerFor} on a + * An Advancer tree is created by calling {@link Advancer#from(Resolver.Action)} on a * {@link Resolver.Action} object. The resulting tree mimics the reader schema * of that Action object. * @@ -39,30 +39,27 @@ import org.apache.avro.util.Utf8; * depth-first fashion. When it hits a leaf of type <code>Xyz</code>, it should * call corresponding <code>nextXyx</code> on the Advancer. For example, if the * reader hits a lead indicating that an integer should be read, it should call - * {@link nextInt}, as in <code>a.nextInt(in)</code>, where <code>a</code> is + * {@link Advancer#nextInt}, as in <code>a.nextInt(in)</code>, where <code>a</code> is * the advancer being traversed, and <code>in</code> is the Decoder being read * from. * * When traversing an Array or Map in the reader schema, the decoder should call - * {@link getElementAdvancer} to retrieve the advancer object for the contained + * {@link Advancer.Container#elementAdvancer} to retrieve the advancer object for the contained * element-schema or value-schema. See the JavaDoc for - * {@link getElementAdvancer} for instructions on how to decode these types. + * {@link Advancer.Container#elementAdvancer} for instructions on how to decode these types. * - * For unions, the decoder should call {@link nextIndex} to fetch the branch and - * then {@link getBranchAdvancer} to get the advancer of that branch. (Calling - * {@link next} on a union will read the index, pick the right advancer based on + * For unions, the decoder should call {@link Advancer#nextIndex} to fetch the branch and + * then {@link Advancer#getBranchAdvancer} to get the advancer of that branch. (Calling + * {@link Advancer#next} on a union will read the index, pick the right advancer based on * the index, and then read and return the actual value.) * * Traversing records, arrays, and maps is more involved. In the case of an - * array or map, call {@link getArrayAdvancer} {@link getMapAdvancer} and + * array or map, call {@link Advancer#getArrayAdvancer} {@link Advancer#getMapAdvancer} and * proceed as described in the documentation for {@link Advancer.Container}. For * records, best to just look at the implementation of * {@link GenericDatumReader2}. **/ abstract class Advancer { - protected Exception exception() { - throw new UnsupportedOperationException(); - } //// API methods of Advancer. Used by decoding methods to //// read values out of Decoder, applying resolution logic @@ -80,63 +77,51 @@ abstract class Advancer { } public Object next(Decoder in) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } public Object nextNull(Decoder in) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } public boolean nextBoolean(Decoder in) throws IOException { - exception(); - return false; + throw new UnsupportedOperationException(); } public int nextInt(Decoder in) throws IOException { - exception(); - return 0; + throw new UnsupportedOperationException(); } public long nextLong(Decoder in) throws IOException { - exception(); - return 0; + throw new UnsupportedOperationException(); } public float nextFloat(Decoder in) throws IOException { - exception(); - return 0; + throw new UnsupportedOperationException(); } public double nextDouble(Decoder in) throws IOException { - exception(); - return 0; + throw new UnsupportedOperationException(); } public int nextEnum(Decoder in) throws IOException { - exception(); - return 0; + throw new UnsupportedOperationException(); } public Utf8 nextString(Decoder in, Utf8 old) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } public String nextString(Decoder in) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } public ByteBuffer nextBytes(Decoder in, ByteBuffer old) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } public byte[] nextFixed(Decoder in, byte[] bytes, int start, int length) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } public byte[] nextFixed(Decoder in, byte[] bytes) throws IOException { @@ -145,35 +130,30 @@ abstract class Advancer { /** Get index for a union. */ public int nextIndex(Decoder in) throws IOException { - exception(); - return 0; + throw new UnsupportedOperationException(); } /** - * Access to contained advancer for unions. You must call {@link nextIndex} + * Access to contained advancer for unions. You must call {@link Advancer#nextIndex} * before calling this method. */ public Advancer getBranchAdvancer(Decoder in, int branch) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } /** Access to advancer for array type. */ public Container getArrayAdvancer(Decoder in) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } /** Access to advancer for array type. */ public Map getMapAdvancer(Decoder in) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } /** Access to advancer for record type. */ public Record getRecordAdvancer(Decoder in) throws IOException { - exception(); - return null; + throw new UnsupportedOperationException(); } ////// Here's the builder for Advancer trees. The subclasses used by @@ -836,9 +816,9 @@ abstract class Advancer { //// fields, read fields out of order, and use default values. /** - * Advancer for records. The {@link advancers} array contains an advancer for + * Advancer for records. The {@link Advancer.Record#advancers} array contains an advancer for * each field, ordered according writer (which determines the order in which - * data must be read). The {@link readerOrder} array tells you how those + * data must be read). The {@link Advancer.Record#readerOrder} array tells you how those * advancers line up with the reader's fields. Thus, the following is how to * read a record: * @@ -849,10 +829,10 @@ abstract class Advancer { * a.done(in); * </pre> * - * Note that a decoder <em>must</em> call {@link done} after interpreting all - * the elemnts in {@link advancers}. + * Note that a decoder <em>must</em> call {@link Advancer.Record#done} after interpreting all + * the elemnts in {@link Advancer.Record#advancers}. * - * As a convenience, {@link inOrder} is set to true iff the reader and writer + * As a convenience, {@link Advancer.Record#inOrder} is set to true iff the reader and writer * order agrees (i.e., iff <code>readerOrder[i].pos() == * i</code> for all i). Generated code can use this to optimize this common * case. @@ -876,7 +856,7 @@ abstract class Advancer { return this; } - /** Must be called after consuming all elements of {@link advancers}. */ + /** Must be called after consuming all elements of {@link Advancer.Record#advancers}. */ public void done(Decoder in) throws IOException { ignore(finalSkips, in); } diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader2.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader2.java index 19c77a8..a3c4591 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader2.java +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader2.java @@ -144,4 +144,3 @@ public class GenericDatumReader2<D> implements DatumReader<D> { throw new UnsupportedOperationException(); } } -
