Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *    http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 package org.apache.spark.sql.connector.catalog;
0019 
0020 import org.apache.spark.annotation.Evolving;
0021 import org.apache.spark.sql.sources.Filter;
0022 
0023 /**
0024  * A mix-in interface for {@link Table} delete support. Data sources can implement this
0025  * interface to provide the ability to delete data from tables that matches filter expressions.
0026  *
0027  * @since 3.0.0
0028  */
0029 @Evolving
0030 public interface SupportsDelete {
0031   /**
0032    * Delete data from a data source table that matches filter expressions.
0033    * <p>
0034    * Rows are deleted from the data source iff all of the filter expressions match. That is, the
0035    * expressions must be interpreted as a set of filters that are ANDed together.
0036    * <p>
0037    * Implementations may reject a delete operation if the delete isn't possible without significant
0038    * effort. For example, partitioned data sources may reject deletes that do not filter by
0039    * partition columns because the filter may require rewriting files without deleted records.
0040    * To reject a delete implementations should throw {@link IllegalArgumentException} with a clear
0041    * error message that identifies which expression was rejected.
0042    *
0043    * @param filters filter expressions, used to select rows to delete when all expressions match
0044    * @throws IllegalArgumentException If the delete is rejected due to required effort
0045    */
0046   void deleteWhere(Filter[] filters);
0047 }