igalshilman commented on a change in pull request #7655: [FLINK-11539] Add 
TypeSerializerSnapshot for TraversableSerializer
URL: https://github.com/apache/flink/pull/7655#discussion_r255447491
 
 

 ##########
 File path: 
flink-scala/src/main/scala/org/apache/flink/api/scala/codegen/TypeInformationGen.scala
 ##########
 @@ -238,10 +243,24 @@ private[flink] trait TypeInformationGen[C <: Context] {
       val elementTpe = $elementTypeInfo
       new TraversableTypeInfo($collectionClass, elementTpe) {
         def createSerializer(executionConfig: ExecutionConfig) = {
+          val elementSerializer = elementTpe.createSerializer(executionConfig)
+
+          // 
-------------------------------------------------------------------------------------
+          // NOTE:
+          // the following anonymous class is needed here, and should not be 
removed
+          // (although appears to be unused) since it is required for 
backwards compatibility
+          // with Flink versions pre 1.8, that were using Java deserialization.
+          // 
-------------------------------------------------------------------------------------
+          val unused = new TraversableSerializer[${desc.tpe}, 
${desc.elem.tpe}](
+              elementSerializer,
+              $cbfStringLiteral) {
+
+                  override def legacyCbfCode = $cbfStringLiteral
+              }
+
           new TraversableSerializer[${desc.tpe}, ${desc.elem.tpe}](
-              elementTpe.createSerializer(executionConfig)) {
-            def getCbf = implicitly[CanBuildFrom[${desc.tpe}, 
${desc.elem.tpe}, ${desc.tpe}]]
-          }
+                                  elementSerializer,
 
 Review comment:
   One reason to do share it, is maybe the users would feel surprised if the 
serializer was created twice instead of once (i.e. log message, class path 
scanning etc', reflection and introspection)
   
   But I don't know.. I'd go with your intuition here @tzulitai :-)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to