Fokko commented on code in PR #2695:
URL: https://github.com/apache/iceberg-python/pull/2695#discussion_r2651021990
##########
pyiceberg/expressions/visitors.py:
##########
@@ -1970,11 +1975,37 @@ def residual_for(self, partition_data: Record) ->
BooleanExpression:
return self.expr
-def residual_evaluator_of(
+_DEFAULT_RESIDUAL_EVALUATOR_CACHE_SIZE = 128
+
+
+def _residual_evaluator_cache_key(
+ spec: PartitionSpec, expr: BooleanExpression, case_sensitive: bool,
schema: Schema
+) -> tuple[Hashable, ...]:
+ return hashkey(spec.spec_id, repr(expr), case_sensitive, schema.schema_id)
Review Comment:
Building the `repr` of the `expr` is super expensive. I think it would make
more sense to implement `__hash__` on the Expression?
--
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]