rdblue commented on code in PR #6127: URL: https://github.com/apache/iceberg/pull/6127#discussion_r1027340824
########## python/pyiceberg/expressions/visitors.py: ########## @@ -417,6 +422,75 @@ def visit_bound_predicate(self, predicate) -> BooleanExpression: return predicate +def expression_evaluator(schema: Schema, unbound: BooleanExpression, case_sensitive=True) -> Callable[[StructProtocol], bool]: + return _ExpressionEvaluator(schema, unbound, case_sensitive).eval + + +class _ExpressionEvaluator(BoundBooleanExpressionVisitor[bool]): + bound: BooleanExpression + struct: StructProtocol + + def __init__(self, schema: Schema, unbound: BooleanExpression, case_sensitive=True): Review Comment: Fixed. ########## python/pyiceberg/expressions/visitors.py: ########## @@ -417,6 +422,75 @@ def visit_bound_predicate(self, predicate) -> BooleanExpression: return predicate +def expression_evaluator(schema: Schema, unbound: BooleanExpression, case_sensitive=True) -> Callable[[StructProtocol], bool]: + return _ExpressionEvaluator(schema, unbound, case_sensitive).eval + + +class _ExpressionEvaluator(BoundBooleanExpressionVisitor[bool]): + bound: BooleanExpression + struct: StructProtocol + + def __init__(self, schema: Schema, unbound: BooleanExpression, case_sensitive=True): + self.bound = bind(schema, unbound, case_sensitive) + + def eval(self, struct: StructProtocol): Review Comment: Added. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org