fury icon indicating copy to clipboard operation
fury copied to clipboard

[Java] fast object copy framework in fury java

Open chaokunyang opened this issue 1 year ago • 0 comments

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
  • MakeSerializer implement 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

chaokunyang avatar Jun 11 '24 15:06 chaokunyang