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

Switch to Threaded View
Accumulo >> mail # user >> RE: EXTERNAL: Re: Iterators and seeking the middle of a row


Copy link to this message
-
Re: EXTERNAL: Re: Iterators and seeking the middle of a row
On Thu, Sep 13, 2012 at 4:44 PM, Cardon, Tejay E <[EMAIL PROTECTED]>wrote:

>  Excellent, thank you William.  That raises an interesting point for me.
> In my case, as with the IntersectingIterator, the schema of my iterator’s
> topKey and topValue is not the same as the schema for the underlying source.
> ****
>
> ** **
>
> In IntersectingIterator, for example, the underlying source has data in
> the format;****
>
> ** **
>
> row: shardID, colfam: term, colqual: docID****
>
> ** **
>
> But the data being returned by the iterator is in the form****
>
> ** **
>
> row: shardID, colfam: (empty), colqual: docID****
>
> ** **
>
> Would I expect a seek on that iterator to have a range based on the ColF
> and ColQ being returned, or the ones being used on the sources?****
>
> ** **
>
> It appears from the code of IntersectingIterator that seek is called based
> on the out-going schema, and the code then translates the keys in the range
> into the source schema before seeking the sources.
>

Yes, I believe that is correct.  The seek is passed down through the
iterator stack, so an iterator that changes the schema has an opportunity
to adjust the range when seeking its sources.  We recently discovered that
the behavior with column filtering is not as intuitive.  When you fetch
columns with a scanner, column filters are created at the system level (so
they'll be sources for user level iterators) and they are passed the set of
fetched columns directly, without giving the user iterators a chance to
transform the columns.  This doesn't come up with the IntersectingIterator
because it manages the columns itself (there's no reason to fetch columns
with it), but in general this would be something to watch out for when
writing schema-transforming iterators.

Billie
****
>
> ** **
>
> Thanks,****
>
> Tejay****
>
> ** **
>
> ** **
>
> *From:* William Slacum [mailto:[EMAIL PROTECTED]]
> *Sent:* Thursday, September 13, 2012 4:39 PM
> *To:* [EMAIL PROTECTED]
> *Subject:* EXTERNAL: Re: Iterators and seeking the middle of a row****
>
> ** **
>
> Another thing to keep in mind is that the documentation is actually meant
> to enforce the notion that, between returning keys, your iterator could be
> destroyed and reconstituted. If an iterator is originally given a range,
> ("a", "c"), and it returns a key "b", the system *may* deconstruct the
> iterator stack and at a later time, reinitialize it with the range ("b",
> "c"), since "b" was the last place your iterator stack was known to be at.
> ****
>
> On Thu, Sep 13, 2012 at 3:34 PM, William Slacum <
> [EMAIL PROTECTED]> wrote:****
>
> Remember that the range given to an iterator is, at some point in time,
> user set. If a client only wants to scan between keys K1 and K2, and each
> occur in the same row, then the iterator should not be considering data
> that is outside of the range supplied to it. Someone can correct me if I'm
> wrong, but I also believe that if a client received a key outside of the
> original scan range, then that was considered a termination condition and
> the scan would stop.
>
> Let's say I have a flat record structure for people, where the row is the
> name of the person, the column family is some attribute about them, and the
> column qualifier is the value for that attribute. Here's a record for Bob:
>
> Bob eyes: blue
> Bob hair: brown
> Bob height: tall
> Bob pants: brown
> Bob shirt: white
> Bob tie: blue
>
> If you were searching for all attributes that were 'brown', you could do a
> look up using the range `new Range("Bob", "Bob")`. Your iterator would be
> able to see all of Bob and return to the user his hair and pants color.
> However, you could just as easily perform your look up with `new Range(new
> Key("Bob", "height"), new Key("Bob", "z"))`*. Your iterator would then be
> allowed to look at a subset of Bob, starting at his height and continuing
> until the end of his record.
>
> * I used "z" because it sorts lexicographically after the other attributes.