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.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanapplyDeleteFilters(List<ResolvedExpression> filters) Provides a list of filters specified byWHEREclause in conjunctive form and return the acceptance status to planner during planning phase.Deletes data during execution phase.
-
Method Details
-
applyDeleteFilters
Provides a list of filters specified byWHEREclause in conjunctive form and return the acceptance status to planner during planning phase.- Parameters:
filters- a list of resolved filter expressions.- Returns:
- true if the sink accepts all filters; false otherwise.
-
executeDeletion
Deletes data during execution phase.Note: The method will be involved iff the method
applyDeleteFilters(List)returns true.- Returns:
- the number of the estimated rows to be deleted, or
Optional.empty()for the unknown condition.
-