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

Switch to Threaded View
Pig >> mail # dev >> Is there any reason why the private instance methods of BinInterSedes shouldn't be made protected static?


Copy link to this message
-
Re: Is there any reason why the private instance methods of BinInterSedes shouldn't be made protected static?
+1, I see no problem in moving them to package visibility.
I wouldn't make them public though as the serialization format is subject
to change.

Cheers,
--
Gianmarco

On Fri, Apr 6, 2012 at 18:42, Dmitriy Ryaboy <[EMAIL PROTECTED]> wrote:

> I think you can safely pull out such functionality into a general helper
> class.
>
> On Fri, Apr 6, 2012 at 9:29 AM, Jonathan Coveney <[EMAIL PROTECTED]>
> wrote:
> > https://issues.apache.org/jira/browse/PIG-2632
> >
> > I'm working on a way to use code generation to generate custom Tuples
> when
> > the Schema is known. There is a serialization benefit because you can
> just
> > write your primitives and objects directly without having to write the
> byte
> > type, since you know what it is. However, since that logic has to live in
> > the generated code, it can't currently leverage logic in BinInterSedes
> > because it is all private, and I don't want to go through
> write(DataOutput,
> > Object, byte) for everything when the specific method I want already
> > exists... which has led to me having to duplicate code for the
> > serialization of byte[]s and Strings and such.
> >
> > 2012/4/6 Gianmarco De Francisci Morales <[EMAIL PROTECTED]>
> >
> >> Well, those methods are really specific to the serialization format
> defined
> >> by BinInterSedes.
> >> How do you envision those methods to be used by other classes without
> using
> >> the public ones?
> >> Which classes are you thinking about?
> >>
> >> Cheers,
> >> --
> >> Gianmarco
> >>
> >>
> >>
> >> On Fri, Apr 6, 2012 at 08:48, Jonathan Coveney <[EMAIL PROTECTED]>
> wrote:
> >>
> >> > The vast majority don't use any state, and could be potentially
> useful to
> >> > other classes that want to do serialization.
> >> >
> >> > I guess the other way to take it is that the logic of those classes
> >> should
> >> > be put into BinInterSedes, but this isn't always reasonable or
> desirable.
> >> >
> >> > Thoughts? Any pitfalls I am missing?
> >> >
> >>
>