LoranceChen opened a new issue, #1683:
URL: https://github.com/apache/incubator-fury/issues/1683

   Currently, for scala, add new field and deserialize from old binary data 
will get a `null` as new field value. But avoid null is a good practice in 
scala language.
   ```scala
     val personBytes = readBytesFromFile("person_v1") // there are old version 
`Person(1,true,some text)`
     //  append field as new person: case class Person(a: Int, b: Boolean, c: 
String, d: String = "default d")
     val deserPerson = fury.deserializeJavaObject(personBytes, classOf[Person])
     println(s"deserPerson: ${deserPerson}") // deserPerson: Person(1,true,some 
text,null)
   ```
   
   I think it's better using default value our a empty value to set the new 
field. Such as give the result:
   ```scala
   // deserPerson: Person(1,true,some text, "default d")
   ```
   And if there not a default value in the field define, can give a empty 
value. For String is `""` will be better for null.
   
   If the new field is a structure, can using a default value to instance this 
one.
   `case class Foo(a: String, b: Int)` can setting the default value as 
`Foo("", 0)`
   
   However, for some performance care scenario. Using `null` should be better 
and handler by develop.
   
   I advice add a new configuration to decide using the default value or `null` 
for new field.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to