Serialising null value in case-class

2019-04-26 Thread Averell
Good day, I have a case-class defined like this: case class MyClass(ts: Long, s1: String, s2: String, i1: Integer, i2: Integer) object MyClass { val EMPTY = MyClass(0L, null, null, 0, 0) def apply(): MyClass = EMPTY } My code has been running fine (I was not aware of

Re: Serialising null value in case-class

2019-04-26 Thread Timo Walther
Hi Averell, the reason for this lies in the internal serializer implementation. In general, the composite/wrapping type serializer is responsible for encoding nulls. The case class serialzer does not support nulls, because Scala discourages the use of nulls and promotes `Option`. Some seriali

Re: Serialising null value in case-class

2019-04-26 Thread Averell
Thank you Timo. In term of performance, does the use of Option[] cause performance impact? I guess that there is because there will be one more layer of object handling, isn't it? I am also confused about choosing between primitive types (Int, Long) vs object type (Integer, JLong). I have seen ma

Re: Serialising null value in case-class

2019-04-26 Thread Timo Walther
Currently, tuples and case classes are the most efficient data types because they avoid the need for special null handling. Everything else is hard to estimate. You might need to perform micro benchmarks with the serializers you want to use if you have a very performance critical use case. Obje

Re: Serialising null value in case-class

2019-04-27 Thread Averell
Thank you Timo. -- Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/