@PublicEvolving public interface SupportsDeletePushDown
WHERE
clause in delete statement to
DynamicTableSink
. The table sink can delete existing data directly according to the
filters.
Flink will get the filters in conjunctive form and push down the filters into sink by calling
method applyDeleteFilters(List)
in the planning phase. If it returns true, Flink will
then call executeDeletion()
to execute the actual deletion during execution phase.
Given the following SQL:
DELETE FROM t WHERE (a = '1' OR a = '2') AND b IS NOT NULL;*
In the example above, the WHERE
clause will be decomposed into two filters
[a = '1' OR a = '2']
[b IS NOT NULL]
If the sink can accept both filters which means the sink can delete data directly according to
the filters, applyDeleteFilters(List)
should return true. Otherwise, it should return
false.
Note: For the cases where the filter expression is not available, e.g., sub-query or applyDeleteFilters(List)
returns false, if the sink implements SupportsRowLevelDelete
,
Flink will try to rewrite the delete statement and produce row-level changes, see SupportsRowLevelDelete
for more details. Otherwise, Flink will throw UnsupportedOperationException
.
Modifier and Type | Method and Description |
---|---|
boolean |
applyDeleteFilters(List<ResolvedExpression> filters)
Provides a list of filters specified by
WHERE clause in conjunctive form and return
the acceptance status to planner during planning phase. |
Optional<Long> |
executeDeletion()
Deletes data during execution phase.
|
boolean applyDeleteFilters(List<ResolvedExpression> filters)
WHERE
clause in conjunctive form and return
the acceptance status to planner during planning phase.filters
- a list of resolved filter expressions.Optional<Long> executeDeletion()
Note: The method will be involved iff the method applyDeleteFilters(List)
returns
true.
Optional.empty()
for the
unknown condition.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.