lincoln-lil commented on code in PR #21658: URL: https://github.com/apache/flink/pull/21658#discussion_r1069527034
########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/abilities/SupportsRowLevelModificationScan.java: ########## @@ -0,0 +1,79 @@ +/* + * 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.source.abilities; + +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.source.ScanTableSource; + +import javax.annotation.Nullable; + +/** + * Enables to tell the {@link ScanTableSource} the type of row-level modification the table source + * scan is for, and return {@link RowLevelModificationScanContext} which will then be passed to the + * sink which implements {@link SupportsRowLevelUpdate} or {@link SupportsRowLevelDelete}. It allows + * the table source to pass information to the table sink which is to be updated/deleted. Review Comment: 'It allows the table source to pass information about the data to be updated/deleted to the table sink.' ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/abilities/SupportsRowLevelModificationScan.java: ########## @@ -0,0 +1,79 @@ +/* + * 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.source.abilities; + +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.source.ScanTableSource; + +import javax.annotation.Nullable; + +/** + * Enables to tell the {@link ScanTableSource} the type of row-level modification the table source + * scan is for, and return {@link RowLevelModificationScanContext} which will then be passed to the Review Comment: -> 'the table source is scanning for, and return {@link RowLevelModificationScanContext} which is then passed to the sink...' may it be better? ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/RowLevelModificationScanContext.java: ########## @@ -0,0 +1,37 @@ +/* + * 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; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.table.connector.source.abilities.SupportsRowLevelModificationScan; + +/** + * The context for scan the table to do updated/delete, designed to provide some necessary Review Comment: 'This context is intended to provide the relevant table scan information needed by the sink to perform a row-level update/delete. It will be generated by a table source that implements {@link SupportsRowLevelModificationScan} and then passed to a sink that implements {@link SupportsRowLevelUpdate} or {@link SupportsRowLevelDelete} for executing UPDATE/DELETE statements during the compilation phase. This mechanism enables coordination between the source and sink for the corresponding table updates/deletes. Connectors can implement this interface to provide custom information.' ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/abilities/SupportsRowLevelModificationScan.java: ########## @@ -0,0 +1,79 @@ +/* + * 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.source.abilities; + +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.source.ScanTableSource; + +import javax.annotation.Nullable; + +/** + * Enables to tell the {@link ScanTableSource} the type of row-level modification the table source + * scan is for, and return {@link RowLevelModificationScanContext} which will then be passed to the + * sink which implements {@link SupportsRowLevelUpdate} or {@link SupportsRowLevelDelete}. It allows + * the table source to pass information to the table sink which is to be updated/deleted. + * + * <p>Note: This interface is optional for table source to support update/delete existing data. For + * the case that the table source won't need to know the type of row-level modification or pass + * information to sink, the table source doesn't need to implement it. + * + * <p>Note: Only if the {@link ScanTableSource} implements this interface, and the table is to be + * scanned to update/delete a table, the method {@link #applyRowLevelModificationScan} for the + * corresponding table source will be involved . For more details, please see the method {@link + * #applyRowLevelModificationScan}. + */ +public interface SupportsRowLevelModificationScan { + + /** + * Apply the type of row-level modification and the previous {@link Review Comment: 'Applies' ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/abilities/SupportsRowLevelModificationScan.java: ########## @@ -0,0 +1,79 @@ +/* + * 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.source.abilities; + +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.source.ScanTableSource; + +import javax.annotation.Nullable; + +/** + * Enables to tell the {@link ScanTableSource} the type of row-level modification the table source + * scan is for, and return {@link RowLevelModificationScanContext} which will then be passed to the + * sink which implements {@link SupportsRowLevelUpdate} or {@link SupportsRowLevelDelete}. It allows + * the table source to pass information to the table sink which is to be updated/deleted. + * + * <p>Note: This interface is optional for table source to support update/delete existing data. For Review Comment: 'table source' -> 'table sources' ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/abilities/SupportsRowLevelModificationScan.java: ########## @@ -0,0 +1,79 @@ +/* + * 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.source.abilities; + +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.source.ScanTableSource; + +import javax.annotation.Nullable; + +/** + * Enables to tell the {@link ScanTableSource} the type of row-level modification the table source + * scan is for, and return {@link RowLevelModificationScanContext} which will then be passed to the + * sink which implements {@link SupportsRowLevelUpdate} or {@link SupportsRowLevelDelete}. It allows + * the table source to pass information to the table sink which is to be updated/deleted. + * + * <p>Note: This interface is optional for table source to support update/delete existing data. For + * the case that the table source won't need to know the type of row-level modification or pass + * information to sink, the table source doesn't need to implement it. + * + * <p>Note: Only if the {@link ScanTableSource} implements this interface, and the table is to be + * scanned to update/delete a table, the method {@link #applyRowLevelModificationScan} for the Review Comment: 'The {@link #applyRowLevelModificationScan} method of the corresponding table source is involved only if the {@link ScanTableSource} implements this interface and the table is to be scanned to update/delete a table's data.' ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/abilities/SupportsRowLevelModificationScan.java: ########## @@ -0,0 +1,79 @@ +/* + * 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.source.abilities; + +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.source.ScanTableSource; + +import javax.annotation.Nullable; + +/** + * Enables to tell the {@link ScanTableSource} the type of row-level modification the table source + * scan is for, and return {@link RowLevelModificationScanContext} which will then be passed to the + * sink which implements {@link SupportsRowLevelUpdate} or {@link SupportsRowLevelDelete}. It allows + * the table source to pass information to the table sink which is to be updated/deleted. + * + * <p>Note: This interface is optional for table source to support update/delete existing data. For + * the case that the table source won't need to know the type of row-level modification or pass Review Comment: 'For cases where the table source does not need to know' ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/abilities/SupportsRowLevelModificationScan.java: ########## @@ -0,0 +1,79 @@ +/* + * 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.source.abilities; + +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.source.ScanTableSource; + +import javax.annotation.Nullable; + +/** + * Enables to tell the {@link ScanTableSource} the type of row-level modification the table source + * scan is for, and return {@link RowLevelModificationScanContext} which will then be passed to the + * sink which implements {@link SupportsRowLevelUpdate} or {@link SupportsRowLevelDelete}. It allows + * the table source to pass information to the table sink which is to be updated/deleted. + * + * <p>Note: This interface is optional for table source to support update/delete existing data. For + * the case that the table source won't need to know the type of row-level modification or pass + * information to sink, the table source doesn't need to implement it. + * + * <p>Note: Only if the {@link ScanTableSource} implements this interface, and the table is to be + * scanned to update/delete a table, the method {@link #applyRowLevelModificationScan} for the + * corresponding table source will be involved . For more details, please see the method {@link + * #applyRowLevelModificationScan}. + */ +public interface SupportsRowLevelModificationScan { + + /** + * Apply the type of row-level modification and the previous {@link + * RowLevelModificationScanContext} returned by previous table source scan, return a new {@link + * RowLevelModificationScanContext} which will then finally to be passed to the table sink. + * + * <p>Note: for the all tables in the UPDATE/DELETE statement, this method will be involved for + * the corresponding table source scan. + * + * <p>Note: it may have multiple table sources in the case of sub-query. In such case, it will + * return multiple {@link RowLevelModificationScanContext}. To handle such case, the planner + * will also pass the previous {@link RowLevelModificationScanContext} to the current table + * source scan to make it decide how to deal with the previous {@link Review Comment: 'source scan, which will decide what to do with the previous {@link RowLevelModificationScanContext}. This order is consistent with the compilation order of the table sources.' ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/abilities/SupportsRowLevelModificationScan.java: ########## @@ -0,0 +1,79 @@ +/* + * 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.source.abilities; + +import org.apache.flink.table.connector.RowLevelModificationScanContext; +import org.apache.flink.table.connector.source.ScanTableSource; + +import javax.annotation.Nullable; + +/** + * Enables to tell the {@link ScanTableSource} the type of row-level modification the table source + * scan is for, and return {@link RowLevelModificationScanContext} which will then be passed to the + * sink which implements {@link SupportsRowLevelUpdate} or {@link SupportsRowLevelDelete}. It allows + * the table source to pass information to the table sink which is to be updated/deleted. + * + * <p>Note: This interface is optional for table source to support update/delete existing data. For + * the case that the table source won't need to know the type of row-level modification or pass + * information to sink, the table source doesn't need to implement it. + * + * <p>Note: Only if the {@link ScanTableSource} implements this interface, and the table is to be + * scanned to update/delete a table, the method {@link #applyRowLevelModificationScan} for the + * corresponding table source will be involved . For more details, please see the method {@link + * #applyRowLevelModificationScan}. + */ +public interface SupportsRowLevelModificationScan { + + /** + * Apply the type of row-level modification and the previous {@link + * RowLevelModificationScanContext} returned by previous table source scan, return a new {@link Review Comment: 'returns a new {@link RowLevelModificationScanContext}' and passes it as the final one to the table sink.' -- 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]
