twalthr commented on code in PR #25064: URL: https://github.com/apache/flink/pull/25064#discussion_r1672278690
########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecSink.java: ########## @@ -33,19 +34,38 @@ import org.apache.flink.table.planner.plan.nodes.exec.ExecNode; import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeConfig; import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeContext; +import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeMetadata; import org.apache.flink.table.planner.plan.nodes.exec.InputProperty; import org.apache.flink.table.planner.plan.nodes.exec.common.CommonExecSink; import org.apache.flink.table.planner.plan.nodes.exec.spec.DynamicTableSinkSpec; import org.apache.flink.table.types.logical.LogicalType; import org.apache.flink.table.types.logical.RowType; +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator; +import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty; + import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * Batch {@link ExecNode} to write data into an external sink defined by a {@link DynamicTableSink}. */ +@ExecNodeMetadata( + name = "batch-exec-sink", + version = 1, + consumedOptions = { + "table.exec.sink.not-null-enforcer", + "table.exec.sink.type-length-enforcer", + }, + producedTransformations = { + CommonExecSink.CONSTRAINT_VALIDATOR_TRANSFORMATION, + CommonExecSink.PARTITIONER_TRANSFORMATION, + CommonExecSink.TIMESTAMP_INSERTER_TRANSFORMATION, Review Comment: should be safe to remove, as the rowtime field is never set in batch ########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecCalc.java: ########## @@ -65,6 +76,29 @@ public BatchExecCalc( description); } + @JsonCreator + public BatchExecCalc( + @JsonProperty(FIELD_NAME_ID) int id, + @JsonProperty(FIELD_NAME_TYPE) ExecNodeContext context, + @JsonProperty(FIELD_NAME_CONFIGURATION) ReadableConfig persistedConfig, + @JsonProperty(FIELD_NAME_PROJECTION) List<RexNode> projection, + @JsonProperty(FIELD_NAME_CONDITION) @Nullable RexNode condition, + @JsonProperty(FIELD_NAME_INPUT_PROPERTIES) List<InputProperty> inputProperties, + @JsonProperty(FIELD_NAME_OUTPUT_TYPE) RowType outputType, + @JsonProperty(FIELD_NAME_DESCRIPTION) String description) { + super( + id, + context, + persistedConfig, + projection, + condition, + TableStreamOperator.class, + true, // retainHeader Review Comment: Why is this true here? ########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecSink.java: ########## @@ -568,7 +568,7 @@ public Optional<String> generateUid(String name) { private ProviderContext createProviderContext(ExecNodeConfig config) { return name -> { - if (this instanceof StreamExecNode && config.shouldSetUid()) { + if (!ExecNodeMetadataUtil.isUnsupported(this.getClass()) && config.shouldSetUid()) { Review Comment: we can simplify this clause to: ``` if (config.shouldSetUid()) ``` ########## flink-table/flink-table-planner/src/test/java/org/apache/flink/table/api/CompiledPlanITCase.java: ########## @@ -404,28 +404,13 @@ void testPersistedConfigOption() throws Exception { } @Test - void testBatchMode() { + public void testExecutePlanBatchMode() throws Exception { Review Comment: `public` is not required ########## flink-table/flink-table-planner/src/test/java/org/apache/flink/table/api/CompiledPlanITCase.java: ########## @@ -404,28 +404,13 @@ void testPersistedConfigOption() throws Exception { } @Test - void testBatchMode() { + public void testExecutePlanBatchMode() throws Exception { Review Comment: rename method to `testCompileAndExecutePlanBatchMode` to match with the surrounding methods ########## flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/CalcTestPrograms.java: ########## @@ -36,7 +36,7 @@ */ public class CalcTestPrograms { - static final TableTestProgram SIMPLE_CALC = + public static final TableTestProgram SIMPLE_CALC = Review Comment: The programs are still under `/exec/stream`. Move them up or better into a `common` package -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org