Comments (5)
Hi, great to see can solve it.
Glade to take a PR if possiable and I need sometime to familiar with the repository.
from incubator-fury.
If the field doesn't exist in serialization process, but does exist in deserialization process, we can invoke method like SomeClass$.apply$default$2:()I
to get default value for such field, and set it the object
from incubator-fury.
You can configure FURY_CODE_DIR environment variable to set generated code dir, if you set it to src directory, then you can debug it in IDE when rerun the code
from incubator-fury.
Hi @LoranceChen , thanks for bring this up. It's very necessary to support this in Apache Fury.
Scala didn't provide a method to construct object with default value at bytecode level. It generate bytecode to invoke constructor with all parameters provided, and default params are provided at callsite.
If we need to provide default value when creating object, we need to extract the default value. Fortunately, scala generate a
method like SomeClass$.apply$default$2:()I
:
case class SomeClass(v: List[IdAnyVal], x:Int=1)
// Callsite bytecode
34: getstatic #131 // Field org/apache/fury/serializer/SomeClass$.MODULE$:Lorg/apache/fury/serializer/SomeClass$;
37: invokevirtual #135 // Method org/apache/fury/serializer/SomeClass$.apply$default$2:()I
40: invokespecial #138 // Method org/apache/fury/serializer/SomeClass."<init>":(Lscala/collection/immutable/List;I)V
43: putstatic #87 // Field p:Lorg/apache/fury/serializer/SomeClass;
46: getstatic #143 // Field scala/Predef$.MODULE$:Lscala/Predef$;
We may can detect whether such method exists to know which parameter has default value, and provide it as default value when constructing object. This will take some horse work. We don't have time for this currently. Would you like to contribute to this? The record
contructor in Fury org.apache.fury.builder.ObjectCodecBuilder#createRecord/org.apache.fury.serializer.ObjectSerializer#read
can be taken as an example.
from incubator-fury.
Hi, @chaokunyang , do you some advice to debug the codegen init process?
The generated code seems not easy to trace the logic where it is.
Thanks
from incubator-fury.
Related Issues (20)
- [JavaScript] Move platform-buffer.jpg into benchmark data directory
- [Java] implement fast utf16 to utf8 conversion HOT 3
- java.lang.IndexOutOfBoundsException: No enough data in the stream java.io.ByteArrayInputStream@36f0f1be HOT 3
- org.apache.fury.exception.DeserializationException: Deserialize failed, read objects are: [null]
- Null Pointer in FuryLogger log method HOT 12
- NullPointer from ThreadPoolFury.serialize HOT 7
- Enum with abstract method throw java.lang.UnsupportedOperationException: Class class com.cloud.thales.infrast.persist.Gender doesn't support serialization. HOT 1
- Who is Using Apache Fury? HOT 2
- [Java] add fury deep copy documentation
- [Java] Optimize the copy performance of some thread-safe classes HOT 1
- [Java] Support copy capabilities for some classes without no-argument constructors HOT 3
- [Go] example is wrong HOT 1
- [CI] Rust ci failed
- $JAVA_HOME/bin/java -agentlib:native-image-agent=config-output-dir=/path/to/config-dir/ ...
- The fact that this function is enough now and doesn't break tests is pretty surprising- I think it relates to some work @Andarist might've done here.
- Can fury support serializing enumerations by enumeration name? HOT 2
- [Scala] Support scala object copy HOT 2
- Fury FAQ HOT 5
- [Java] Add support for deserialization between applications and use of typeTag on thread safe instances HOT 1
- [Java] Deserialization optimization, instead of discarding fields, puts non-existent fields into a specified field.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from incubator-fury.