-
Notifications
You must be signed in to change notification settings - Fork 52
Add support for Table<R, C, V> #11
Comments
The MultimapDeserializer is a bit convoluted for what it achieve, I've been wanting to rewrite it but haven't got the time right now to do that. You could instead take a look a GuavaMultisetDeserializer to have a better example of what a "normal" deserializer looks like (and GuavaDeserializers for how to register deserializer). And, as far as I can tell, your Deserializer will not work properly for type deserialization and custom key deserialization, as it's missing type information for the values and keys. If you could provide some basic unit test with your code in a pull request I might take a look at how to include support for Table. I didn't need Table support so that's why I haven't included that yet ;) |
+1 for table support. While the above implementation is missing code for type handling I think a variation can be used for the simple case of |
Code really needs to consider type information. Type parameters are to be handled by But what is really needed is a PR. :) |
I have an implementation of this locally. Before I open up a PR, are you guys ok with these details?
I'm on the fence about that last part. It wouldn't take much to convince me that it's better to default to Any thoughts? |
I am fine with use of delegating serializer and think it is a great starting point; if improvements are needed, it should be easier to do that incrementally. I am ok with mapping of types, although do not know enough to necessarily know possible issues. My main concern is with actual JSON structure used, since once we choose to use certain structure, it becomes our "standard" so to speak; more difficult to change in future. So I do not have concerns with specific scheme used, which sounds acceptable, but rather just the concern that we may not have enough time to get enough developers to review it. But so: looks good to me; happy to merge unless others have concerns, as soon as we have CLA. |
@stevenschlansker WDYT? |
@cowtowncoder I want to go through my employer for the CLA, so it may take a while. |
@michaelhixson note that you can choose whether to do individual CLA or corporate CLA, depending on your specific circumstances. Corporate CLA makes most sense when there are multiple contributors. https://github.com/FasterXML/jackson/blob/master/contributor-agreement-corporate.txt and not the individual one: https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf This based on my previous experiences; former has been used by multiple big (fortune-500) companies; latter has caused heartburn for lawyers of the same (for reasons that are not entirely clear to me :) ). No problem with respect to time it takes: I can merge changes at a later point and will not assume it will get done within day or two. Thank you for the update, it's just good to know what to expect, at this point in release cycle. |
I'm a fan of immutable table over a "custom mutable table", FWIW. Don't have too many other strong opinions. |
Thank you @stevenschlansker. Mostly just wanted a sanity check, easier to make changes upfront, had some bad experiences with date/time lib support where I merged in changes that proved controversial. Choice of immutable/mutable is difficult just because it completely depends on intent (whether usage requires modifications), but as long as more specific type may be used to change behavior that should be fine either way. |
Is it planned to be supported? |
I made a pull request for this and sent in a signed CLA, but I never heard back. I imagine they've been busy with the 2.6 release. It might be about time to ping though... @cowtowncoder Do you know the status of that PR or CLA? |
+1 waiting for this feature too. |
+1 I am also waiting for this feature like the gentlemen in the comment above |
I just did a brief review of the code in the linked PR and it looks very nice. Thank you for the contribution, I'm sure the CLA / merging stuff will get sorted soon. |
I was on vacation for past 2 weeks, back now, and will follow up. |
As per comment, 2.6.2 contains serialization support. Still need to implement deserialization, based on some combination two PRs we have. |
Actually 2.6.2. does not contain serialization support. This on the schedule for 2.7.0 https://github.com/FasterXML/jackson-datatype-guava/blob/master/release-notes/VERSION |
Quick note: moved to FasterXML/jackson-datatypes-collections#1 Not sure how PRs can be moved over; if anyone has time to redo one or both, that would be great. Apologies for hassle. |
The Guava
Table<R, C, V>
data structure is a convenience wrapper around aMap<R, Map<C, V>>
. This form can be easily serialized and deserialized. Here's the basic code I'm using for that:I have not tested if this correctly supports contextual keys or type (de)serialization. I looked at
MultimapSerializer
andMultimapDeserializer
, and they are much more complicated even though aMultimap<K, V>
is just a convenience wrapper aroundMap<K, Collection<V>>
, so maybe this is too simplistic?Notably, this implementation always deserializes to an
ImmutableTable
. Heuristics could be used to determine whatTable
implementation to reconstruct, e.g., if every row, column value is non-null, could createArrayTable
.HashBasedTable
would be a good mutable default.The text was updated successfully, but these errors were encountered: