aokolnychyi commented on a change in pull request #3369:
URL: https://github.com/apache/iceberg/pull/3369#discussion_r736129241
##########
File path:
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java
##########
@@ -212,33 +220,44 @@ private String getRowLevelOperationMode(String operation)
{
@Override
public boolean canDeleteWhere(Filter[] filters) {
- if (table().specs().size() > 1) {
- // cannot guarantee a metadata delete will be successful if we have
multiple specs
- return false;
- }
-
- Set<Integer> identitySourceIds = table().spec().identitySourceIds();
- Schema schema = table().schema();
+ Expression deleteExpr = Expressions.alwaysTrue();
for (Filter filter : filters) {
- // return false if the filter requires rewrite or if we cannot translate
the filter
- if (requiresRewrite(filter, schema, identitySourceIds) ||
SparkFilters.convert(filter) == null) {
+ Expression expr = SparkFilters.convert(filter);
+ if (expr != null) {
+ deleteExpr = Expressions.and(deleteExpr, expr);
+ } else {
return false;
}
}
- return true;
+ return deleteExpr == Expressions.alwaysTrue() ||
canDeleteUsingMetadata(deleteExpr);
Review comment:
We use reference equality for true/false literals in a few places. It
should be safe as these literals are singletons.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]