haodang 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_r339884830
########## 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: Any particular reason you'd prefer to write it out directly inside the class code? I was thinking grouping them into `inputAssignment` and `inputDeclaration` might make generated class code look more succinct, organized, and thus easier to read. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services