fury
fury copied to clipboard
[Java] fast object copy framework in fury java
Is your feature request related to a problem? Please describe.
Deep copy is common in programing to avoid modify existing data, which may introduce side effect and subtle bugs.
Currently fury doesn't support copy natively, users need to serialized data into binary, then deserialize it into object. This is costly, it introduce extra copy, and for immutable objects such as string, time objects, boxed objects, there is no need to copy.
Describe the solution you'd like
We should support copy natively in fury:
- Design a copy interface
- Make
Serializerimplement the copy interface, throw UnsupportedException by default. - For non-jit serializer, override the copy interface to implement copy
- For immutable object such as
String,java.time, just return itself - For mutable object, create new object and set all attributes
- For pojo/bean/record object, implement the copy in a separate class, and forward the copy to that class to reuse the copy implementation in
ObjectSerializer/CompatibleObjectSerializer
Additional context
#1014