@Evolving public interface SupportsDeleteV2 extends TruncatableTable
Table
delete support. Data sources can implement this
interface to provide the ability to delete data from tables that matches filter expressions.Modifier and Type | Method and Description |
---|---|
default boolean |
canDeleteWhere(Predicate[] predicates)
Checks whether it is possible to delete data from a data source table that matches filter
expressions.
|
void |
deleteWhere(Predicate[] predicates)
Delete data from a data source table that matches filter expressions.
|
default boolean |
truncateTable()
Truncate a table by removing all rows from the table atomically.
|
capabilities, columns, name, partitioning, properties, schema
default boolean canDeleteWhere(Predicate[] predicates)
Rows should be deleted from the data source iff all of the filter expressions match. That is, the expressions must be interpreted as a set of filters that are ANDed together.
Spark will call this method at planning time to check whether deleteWhere(Predicate[])
would reject the delete operation because it requires significant effort. If this method
returns false, Spark will not call deleteWhere(Predicate[])
and will try to rewrite
the delete operation and produce row-level changes if the data source table supports deleting
individual records.
predicates
- V2 filter expressions, used to select rows to delete when all expressions
matchvoid deleteWhere(Predicate[] predicates)
canDeleteWhere(Predicate[])
returns true.
Rows are deleted from the data source iff all of the filter expressions match. That is, the expressions must be interpreted as a set of filters that are ANDed together.
Implementations may reject a delete operation if the delete isn't possible without significant
effort. For example, partitioned data sources may reject deletes that do not filter by
partition columns because the filter may require rewriting files without deleted records.
To reject a delete implementations should throw IllegalArgumentException
with a clear
error message that identifies which expression was rejected.
predicates
- predicate expressions, used to select rows to delete when all expressions
matchIllegalArgumentException
- If the delete is rejected due to required effortdefault boolean truncateTable()
TruncatableTable
truncateTable
in interface TruncatableTable