aokolnychyi commented on code in PR #38004: URL: https://github.com/apache/spark/pull/38004#discussion_r982741016
########## sql/catalyst/src/main/java/org/apache/spark/sql/connector/write/DeltaWriter.java: ########## @@ -0,0 +1,62 @@ +/* + * 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.spark.sql.connector.write; + +import java.io.IOException; +import org.apache.spark.annotation.Experimental; + +/** + * A data writer returned by {@link DeltaWriterFactory#createWriter(int, long)} and is + * responsible for writing a delta of rows. + * + * @since 3.4.0 + */ +@Experimental +public interface DeltaWriter<T> extends DataWriter<T> { + /** + * Deletes a row. + * + * @param metadata values for metadata columns that were projected but are not part of the row ID + * @param id a row ID to delete + * @throws IOException if failure happens during disk/network IO like writing files + */ + void delete(T metadata, T id) throws IOException; Review Comment: No problem. It has been a while for me too. A partition tuple can be one example. A data source may be able to handle operations on a primary key but knowing the old record partition can help the data source to encode a delete efficiently. In that case, the partition tuple is not really part of the row ID but rather extra metadata that allows to encode a delete. Another example is a metadata column that would carry the old version of the row. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
