twalthr commented on code in PR #27996:
URL: https://github.com/apache/flink/pull/27996#discussion_r3124254562


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/FromChangelogRestoreTest.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.nodes.exec.stream;
+
+import 
org.apache.flink.table.planner.plan.nodes.exec.testutils.RestoreTestBase;
+import org.apache.flink.table.test.program.TableTestProgram;
+
+import java.util.List;
+
+/**
+ * Restore tests for the built-in FROM_CHANGELOG PTF. Verifies that {@link
+ * org.apache.flink.table.planner.functions.sql.SqlDefaultArgOperator} 
placeholders for unprovided
+ * optional args round-trip through compiled-plan serialization.

Review Comment:
   Nobody cares about this specific bug in the future. So comments can be 
simplified.
   ```suggestion
    * Restore tests for the built-in {@link 
BuiltInFunctionDefinitsions.FROM_CHANGELOG} PTF.
   ```



##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/FromChangelogTestPrograms.java:
##########
@@ -183,6 +183,49 @@ public class FromChangelogTestPrograms {
                                     + "input => TABLE changelog_view)")
                     .build();
 
+    // 
--------------------------------------------------------------------------------------------
+    // Restore tests
+    // 
--------------------------------------------------------------------------------------------
+
+    /**
+     * Append source with retract op codes through FROM_CHANGELOG, split 
across a compiled-plan +
+     * savepoint restore. The unprovided {@code op} and {@code op_mapping} 
args become {@code
+     * DEFAULT()} placeholders that survive {@code toUdfCall} and reach 
codegen on the restore path
+     * - exercising the {@link 
org.apache.flink.table.planner.functions.sql.SqlDefaultArgOperator}

Review Comment:
   ```suggestion
        * savepoint restore. The unprovided {@code op} and {@code op_mapping} 
args become {@code
        * DEFAULT()} placeholders.
   ```



##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/serde/RexNodeJsonDeserializer.java:
##########
@@ -374,7 +375,15 @@ private static RexNode deserializeCall(JsonNode jsonNode, 
SerdeContext serdeCont
         } else {
             callType = serdeContext.getRexBuilder().deriveReturnType(operator, 
rexOperands);
         }
-        return serdeContext.getRexBuilder().makeCall(callType, operator, 
rexOperands);
+        // SqlDefaultArgOperator is constructed per-call site by 
FlinkSqlCallBinding and not

Review Comment:
   Update RexNodeJsonSerdeTest



##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/serde/RexNodeJsonDeserializer.java:
##########
@@ -374,7 +375,15 @@ private static RexNode deserializeCall(JsonNode jsonNode, 
SerdeContext serdeCont
         } else {
             callType = serdeContext.getRexBuilder().deriveReturnType(operator, 
rexOperands);
         }
-        return serdeContext.getRexBuilder().makeCall(callType, operator, 
rexOperands);
+        // SqlDefaultArgOperator is constructed per-call site by 
FlinkSqlCallBinding and not
+        // registered in any operator table, so the lookup above falls through 
to Calcite's stock
+        // SqlStdOperatorTable.DEFAULT_OPERATOR. Rebuild the typed Flink 
instance here so codegen's
+        // `op instanceof SqlDefaultArgOperator` check (StringCallGen) 
recognizes it on restore.

Review Comment:
   ```suggestion
           // SqlDefaultArgOperator is constructed per-call site by 
FlinkSqlCallBinding and not
           // registered in any operator table. Rebuild the typed Flink 
instance here.
   ```



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