Guava Table support and smaller fixes #108
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR;
I noticed that the Guava's Table structure is not directly supported by this library. I need this in my project, so I decided to share my work.
What's inside:
Table
implementations, including:ArrayTable
,HashBasedTable
,TreeBasedTable
andImmutableTable
TreeMultimapSerializer
to include key and value comparators (this allows to serialize aTreeMultimap
together with non-standard comparators)ImmutableMapSerializer
to include some private implementations used byDenseImmutableTable
Details
So I'm using kryo-serializers + subzero + hazelcast + guava. I noticed I couldn't serialize the
ImmutableTable
properly so I decided to investigate why. Surprisingly some of the Table implementations are serialized just fine (e.g.HashBasedTable
) but that is only because they are handled by the genericFieldSerializer
, so their private fields are basically inferred and serialized. The reason why this doesn't work forImmutableTable
implementation is that it internally uses some private implementation ofImmutableMap
(e.g.Column
orRow
) which in turn are serialized by theFieldSerializer
as regularMap
, and fail during deserialization.This PR fixes both sides of this problem: it adds direct support for
Table
implementations (includingImmutableTable
) as well as registers additional private implementations ofImmutableMap
withImmutableMapSerializer
.Additionally I noticed that the
TreeMultimapSerializer
didn't cover non-default comparators. I added support for those inTreeBasedTableSerializer
, so decided to fix it forTreeMultimapSerializer
too.Please take a look and review before merging. I'll appreciate any feedback!