Skip to content

Commit

Permalink
Fixed the classification bug of CheckSchemaPredicateVisitor
Browse files Browse the repository at this point in the history
  • Loading branch information
Caideyipi authored Aug 12, 2024
1 parent fb1ce11 commit ef36053
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

// Return whether input expression has an attribute column predicate
// Return whether input expression can not be bounded to a single ID
public class CheckSchemaPredicateVisitor
extends PredicateVisitor<Boolean, CheckSchemaPredicateVisitor.Context> {

Expand Down Expand Up @@ -79,10 +79,9 @@ protected Boolean visitLogicalExpression(final LogicalExpression node, final Con
context.queryContext.getSql());
lastLogTime = System.currentTimeMillis();
}
return false;
return true;
}
// TODO: separate or concat expressions, e.g. (id1 or id2 or attr) => (id1 or id2) and (attr)
return node.getTerms().stream().allMatch(predicate -> predicate.accept(this, context));
return node.getTerms().stream().anyMatch(predicate -> predicate.accept(this, context));
}

@Override
Expand All @@ -94,7 +93,7 @@ protected Boolean visitNotExpression(final NotExpression node, final Context con
context.queryContext.getSql());
lastLogTime = System.currentTimeMillis();
}
return false;
return true;
}
return node.getValue().accept(this, context);
}
Expand Down

0 comments on commit ef36053

Please sign in to comment.