-
Notifications
You must be signed in to change notification settings - Fork 282
feat(java): row encoder supports custom types and collections #2243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(java): row encoder supports custom types and collections #2243
Conversation
07dabdd
to
276bccb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome! Excelent work
276bccb
to
e602fd8
Compare
Fixed the last bug and applied formatting. |
One question: is there any important difference between |
e602fd8
to
4685049
Compare
I think both are OK |
## What does this PR do? This PR adds documentation to `row_format_guide.md` for recent enhancements that support Java `interface` types and class inheritance (`extends`) in row format mapping. The update includes code examples demonstrating how to register interface mappings and superclass support using Fury's Java API. ## Related issues - #2310 - [#2243](#2243) - [#2250](#2250) - [#2256](#2256) ## Does this PR introduce any user-facing change? Yes. It introduces user-facing documentation explaining how to use interface and extension types with row encoding in Java. --------- Co-authored-by: nabil.shafi <[email protected]>
What does this PR do?
Extend Java Row Format to allow registering custom datatypes (e.g. UUID as Int128) and collection factories (e.g.
SortedSet<UUID>
asnew TreeSet<UUID>(customComparator)
)Additionally supports arrays of custom types e.g.
UUID[]
Since the type inference is in
fury-core
but I wanted to keep new features scoped tofury-format
, I had to add a small plugin interface to core so that format can add types dynamically without affecting existing core behavior.Related issues
#2208
Does this PR introduce any user-facing change?
The
Encoders
class has newregisterCustomCodec
andregisterCustomCollectionFactory
methods.All custom types are written with the existing protocol as embedded memory buffers just like any other field, but with a custom byte representation, so there should be no wire compatibility concerns.
Benchmark
There should be no change to performance in existing use cases. The code is carefully written to have no runtime impact if not used. Custom types are invoked via static methods or instance method on static final fields, which should be easily inlined by jit for minimum overhead.
Here is example generated code to help show this:
https://gist.github.com/stevenschlansker/ed7dae863e78d3c87e30bdea39fa8dea