wuchong commented on a change in pull request #10000: [FLINK-14398][SQL/Legacy 
Planner]Further split input unboxing code into separate methods
URL: https://github.com/apache/flink/pull/10000#discussion_r339905063
 
 

 ##########
 File path: 
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/codegen/CollectorCodeGenerator.scala
 ##########
 @@ -73,19 +73,13 @@ class CollectorCodeGenerator(
     val input1TypeClass = boxedTypeTermForTypeInfo(input1)
     val input2TypeClass = boxedTypeTermForTypeInfo(collectedType)
 
-    // declaration in case of code splits
-    val recordMember = if (hasCodeSplits) {
-      s"private $input2TypeClass $input2Term;"
-    } else {
-      ""
-    }
+    val inputDecleration =
+      List(s"private $input1TypeClass $input1Term;",
+           s"private $input2TypeClass $input2Term;")
 
-    // assignment in case of code splits
-    val recordAssignment = if (hasCodeSplits) {
-      s"$input2Term" // use member
-    } else {
-      s"$input2TypeClass $input2Term" // local variable
-    }
+    val inputAssignment =
+      List(s"$input1Term = ($input1TypeClass) getInput();",
+           s"$input2Term = ($input2TypeClass) record;")
 
 Review comment:
   Hi @haodang , I think variables should be used when they are variable. 
However, in the context, `inputAssignment` and `inputDeclaration` are 
constants.  So I think it would be more readable to put them in generated code, 
rather than guessing values of them.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to