JingsongLi commented on code in PR #20899:
URL: https://github.com/apache/flink/pull/20899#discussion_r980886543


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/OperatorCodeGenerator.scala:
##########
@@ -109,10 +109,16 @@ object OperatorCodeGenerator extends Logging {
 
         $endInput
 
+        @Override
+        public void finish() throws Exception {
+            ${ctx.reuseFinishCode()}
+            super.finish();

Review Comment:
   NIT: why `reuseFinishCode` first, `super.finish` second.



##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/CodeGeneratorContext.scala:
##########
@@ -768,6 +785,14 @@ class CodeGeneratorContext(val tableConfig: 
ReadableConfig, val classLoader: Cla
     }
     reusableOpenStatements.add(openFunction)
 
+    if (function.isInstanceOf[TableFunction[_]]) {
+      val finishFunction =
+        s"""
+           |$fieldTerm.finish();
+       """.stripMargin
+      reusableFinishStatements.add(finishFunction)

Review Comment:
   nit: just `s"$fieldTerm.finish();"`?



##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/stream/table/TemporalTableFunctionJoinTest.xml:
##########
@@ -25,7 +25,7 @@ LogicalJoin(condition=[=($3, $1)], joinType=[inner])
 :     +- LogicalCorrelate(correlation=[$cor0], joinType=[inner], 
requiredColumns=[{}])
 :        :- LogicalProject(o_rowtime=[AS($0, _UTF-16LE'o_rowtime')], 
o_comment=[AS($1, _UTF-16LE'o_comment')], o_amount=[AS($2, 
_UTF-16LE'o_amount')], o_currency=[AS($3, _UTF-16LE'o_currency')], 
o_secondary_key=[AS($4, _UTF-16LE'o_secondary_key')])
 :        :  +- LogicalTableScan(table=[[default_catalog, default_database, 
Orders]])
-:        +- 
LogicalTableFunctionScan(invocation=[*org.apache.flink.table.functions.TemporalTableFunctionImpl$bbf912e58a3fb2d083552961c0f87dbe*($0)],
 rowType=[RecordType(TIMESTAMP(3) *ROWTIME* rowtime, VARCHAR(2147483647) 
comment, VARCHAR(2147483647) currency, INTEGER rate, INTEGER secondary_key)])

Review Comment:
   NIT: Can have `serialVersionUID` in TableFunction to be compatible with 
previous version?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to