LadyForest commented on code in PR #21658: URL: https://github.com/apache/flink/pull/21658#discussion_r1070788300
########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsRowLevelDelete.java: ########## @@ -0,0 +1,114 @@ +/* + * 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.connector.sink.abilities; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.table.catalog.Column; +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.sink.DynamicTableSink; +import org.apache.flink.table.connector.source.abilities.SupportsRowLevelModificationScan; + +import javax.annotation.Nullable; + +import java.util.List; +import java.util.Optional; + +/** + * Interface for {@link DynamicTableSink}s that support delete existing data according to row-level + * changes. The table sink is responsible for telling planner how to produce the row changes, and + * consuming them to achieve rows delete purpose. + * + * <p>The planner will call the method {@link #applyRowLevelDelete(RowLevelModificationScanContext)} + * to get the {@link RowLevelDeleteInfo} returned by sink, and rewrite the delete statement based on + * the gotten {@link RowLevelDeleteInfo} to produce rows to {@link DynamicTableSink}. + * + * <p>Note: If the sink also implements {@link SupportsDeletePushDown}, the planner will always + * prefer {@link SupportsDeletePushDown}, and only the filters aren't available or {@link + * SupportsDeletePushDown#applyDeleteFilters(List)} returns false, this interface will be + * considered. Review Comment: This statement is slightly confusing because the sentence's subject is the **planner**. How could a planner consider an interface? So what about ```java The planner always prefers {@link SupportsDeletePushDown} over {@link SupportsRowLevelDelete} on condition that {@link SupportsDeletePushDown#applyDeleteFilters(List)} returns true. ``` From my perspective, this is relatively concise and clear. If you worry it is not detailed enough, we can add the following description at the end. ```java The sink needs to implement this interface iff {@link SupportsDeletePushDown#applyDeleteFilters(List)} returns false. ``` ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsRowLevelDelete.java: ########## @@ -0,0 +1,114 @@ +/* + * 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.connector.sink.abilities; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.table.catalog.Column; +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.sink.DynamicTableSink; +import org.apache.flink.table.connector.source.abilities.SupportsRowLevelModificationScan; + +import javax.annotation.Nullable; + +import java.util.List; +import java.util.Optional; + +/** + * Interface for {@link DynamicTableSink}s that support delete existing data according to row-level + * changes. The table sink is responsible for telling planner how to produce the row changes, and + * consuming them to achieve rows delete purpose. + * + * <p>The planner will call the method {@link #applyRowLevelDelete(RowLevelModificationScanContext)} + * to get the {@link RowLevelDeleteInfo} returned by sink, and rewrite the delete statement based on + * the gotten {@link RowLevelDeleteInfo} to produce rows to {@link DynamicTableSink}. Review Comment: Nit: `gotten` is a littile bit verbal; how about `retrieved`? -- 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]
