accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Elser <josh.el...@gmail.com>
Subject Re: Map Lexicoder
Date Mon, 28 Dec 2015 17:21:56 GMT
Looks like you would have to implement some kind of ComparableMap to be 
able to use the PairLexicoder (see that the parameterization requires 
both types in the Pair to implement Comparable). The Pair lexicoder 
requires these Comparable types to align itself with the original goal 
of the Lexicoders: provide byte-array serialization for types whose sort 
order matches the original object's ordering.

Typically, when we have key to value style data we want to put in 
Accumulo, it makes sense to leverage the Column Qualifier and the Value, 
instead of serializing everything into one Accumulo Value. Iterators 
make it easy to do server-side predicates and transformations. My hunch 
is that this is another reason why you don't already see a MapLexicoder 
provided.

One technical difficulty you might run into implementing a generalized 
MapLexicoder is how you delimit the key and value in one pair and how 
you delimit many pairs from each other. Commonly, the "null" byte (\x00) 
is used as a separator since it doesn't often appear in user-data. I'm 
not sure if some of the other Lexicoders already use this in their 
serialization (e.g. the ListLexicoder might, I haven't looked at the 
code). Nesting Lexicoders generically might be tricky (although not 
impossible) -- thought it was worth mentioning to make sure you thought 
about it.

Adam J. Shook wrote:
> Hello all,
>
> Any suggestions for using a Map Lexicoder (or implementing one)?  I am
> currently using a new ListLexicoder(new PairLexicoder(some lexicoder,
> some lexicoder), which is working for single maps.  However, when one of
> the lexicoders in the Pair is itself a Map (and therefore another
> ListLexicoder(PairLexicoder)), an exception is being thrown because
> ArrayList is not Comparable.
>
> Regards,
> --Adam

Mime
View raw message