Interface SupportsDeletePushDown
-
@PublicEvolving public interface SupportsDeletePushDownEnables to push down filters decomposed from theWHEREclause in delete statement toDynamicTableSink. 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 callexecuteDeletion()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
WHEREclause 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 implementsSupportsRowLevelDelete, Flink will try to rewrite the delete statement and produce row-level changes, seeSupportsRowLevelDeletefor more details. Otherwise, Flink will throwUnsupportedOperationException.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanapplyDeleteFilters(List<ResolvedExpression> filters)Provides a list of filters specified byWHEREclause in conjunctive form and return the acceptance status to planner during planning phase.Optional<Long>executeDeletion()Deletes data during execution phase.
-
-
-
Method Detail
-
applyDeleteFilters
boolean applyDeleteFilters(List<ResolvedExpression> filters)
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
Optional<Long> 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.
-
-