On Sun, Apr 18, 2010 at 3:23 PM, Sean Owen <sro...@gmail.com> wrote:

> On Sun, Apr 18, 2010 at 11:16 PM, Jake Mannix <jake.man...@gmail.com>
> wrote:
> > VectorWritable currently is a proper decorator, right?  It doesn't even
> > implement Vector at all.
>
> Yeah, the other *Writable classes should be as well. NamedVector
> should both be a Vector and decorate a Vector too. Its Writable also
> decorates a NamedVector.
>
> >
> > What exactly are you suggesting the hierarchy to be?
> >
> >  1) Vector is an interface, NamedVector extends it
>
> (I just have NamedVector as a concrete subclass, a decorator)
>

So NamedVector (I think LabeledVector is probably better, actually)
takes in its constructor another Vector which it delegates to, and then
also has the name/label, sure.


> >  4) VectorWritable acts still just as it is now, basically
>
> Yes, made it more general so we don't have to modify it to handle each
> new Vector impl too.
>

The trick is to make the writing part efficient without knowing the
internals of the vector impl.  I guess there's no really easy way to
read/write a hash-based vector more efficiently than just making
sure the size is right, and then stuffing the read-from-disk values
into the hash, so internals aren't critical.  And as mentioned below,
the constructors for SeqAcc and OrderedIntDoubleMapping both
allow for an efficient read/write impl, as does DenseVector.

Ok, I'm convinced that this should be good for now, until we
get to the happy Avro-future.

  -jake

Reply via email to