Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Avro, mail # user - Upgrade usage of DecoderFactory with upgrade from Avro 1.3.3 --> 1.6.2


+
Lewis John Mcgibbney 2012-02-24, 23:38
+
Scott Carey 2012-02-25, 02:40
+
Lewis John Mcgibbney 2012-02-25, 11:03
Copy link to this message
-
Re: Upgrade usage of DecoderFactory with upgrade from Avro 1.3.3 --> 1.6.2
Lewis John Mcgibbney 2012-02-24, 23:42
Duh...

decoder = new DecoderFactory().directBinaryDecoder(in, decoder)

On Fri, Feb 24, 2012 at 11:38 PM, Lewis John Mcgibbney <
[EMAIL PROTECTED]> wrote:

> Hi List,
>
> I've embarked upon upgrading the Avro (and subsequently Hadoop) libraries
> in Apache Gora to 1.6.2 and 1.0.0 respectively and have run into a small
> (one of many) question.
>
> Use of DecoderFactory().configureDirectDecoder(boolean) is now deprecated
> [0], so I am looking for advice on how to configure the direct decoder
> accordingly, to achieve the same results as explained below.
>
> I was thinking of implementing
>
> decoder = new DecoderFactory().binaryDecoder(in, decoder), however is this
> suitable/satisfactory?
>
> If so can someone please explain why this is the case and how
> functionality has been retained even after removing the configuration for
> the DirectDecoder?
>
> Thank you in advance for any suggestions.
>
> Lewis
>
>   @Override
>   public void open(InputStream in) throws IOException {
>     /* It is very important to use a direct buffer, since Hadoop
>      * supplies an input stream that is only valid until the end of one
>      * record serialization. Each time deserialize() is called, the IS
>      * is advanced to point to the right location, so we should not
>      * buffer the whole input stream at once.
>      */
>     decoder = new DecoderFactory().configureDirectDecoder(true)
>       .createBinaryDecoder(in, decoder);
>   }
>
> [0]
> http://avro.apache.org/docs/1.6.2/api/java/org/apache/avro/io/DecoderFactory.html
> --
>
> *Lewis*
>
>
--
*Lewis*