hehuiyuan opened a new pull request #11870: URL: https://github.com/apache/flink/pull/11870
 This method `generateOneInputStreamOperator` when OperatorCodeGenerator generates SourceConversion: ``` @Override public void processElement($STREAM_RECORD $ELEMENT) throws Exception { $inputTypeTerm $inputTerm = ($inputTypeTerm) ${converter(s"$ELEMENT.getValue()")}; ${ctx.reusePerRecordCode()} ${ctx.reuseLocalVariableCode()} ${if (lazyInputUnboxingCode) "" else ctx.reuseInputUnboxingCode()} $processCode } $inputTypeTerm $inputTerm = ($inputTypeTerm) ${converter(s"$ELEMENT.getValue()")}; ScanUtil calls generateOneInputStreamOperator val generatedOperator = OperatorCodeGenerator.generateOneInputStreamOperator[Any, BaseRow]( ctx, convertName, processCode, outputRowType, converter = inputTermConverter) //inputTermConverter val (inputTermConverter, inputRowType) = { val convertFunc = CodeGenUtils.genToInternal(ctx, inputType) internalInType match { case rt: RowType => (convertFunc, rt) case _ => ((record: String) => s"$GENERIC_ROW.of(${convertFunc(record)})", RowType.of(internalInType)) } } ``` There is an useless cast class code: ``` $inputTypeTerm $inputTerm = ($inputTypeTerm) ${converter(s"$ELEMENT.getValue()")}; ``` CodeGenUtils.scala : genToInternal ``` def genToInternal(ctx: CodeGeneratorContext, t: DataType): String => String = { val iTerm = boxedTypeTermForType(fromDataTypeToLogicalType(t)) if (isConverterIdentity(t)) { term => s"($iTerm) $term" } else { val eTerm = boxedTypeTermForExternalType(t) val converter = ctx.addReusableObject( DataFormatConverters.getConverterForDataType(t), "converter") term => s"($iTerm) $converter.toInternal(($eTerm) $term)" } } ``` The code `($iTerm) ` and `($inputTypeTerm)` are same. ---------------------------------------------------------------- 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