Skip to content

Commit 87cc065

Browse files
committed
Pull in main
1 parent f6084a6 commit 87cc065

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pyiceberg/table/__init__.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@
5858
Reference,
5959
)
6060
from pyiceberg.expressions.visitors import (
61+
ROWS_CANNOT_MATCH,
62+
ROWS_MUST_MATCH,
6163
_InclusiveMetricsEvaluator,
64+
_StrictMetricsEvaluator,
6265
expression_evaluator,
6366
inclusive_projection,
6467
manifest_evaluator,
@@ -2745,7 +2748,7 @@ def __init__(
27452748
def _build_partition_projection(self, spec_id: int) -> BooleanExpression:
27462749
schema = self._transaction.table_metadata.schema()
27472750
spec = self._transaction.table_metadata.specs()[spec_id]
2748-
project = visitors.inclusive_projection(schema, spec)
2751+
project = inclusive_projection(schema, spec)
27492752
return project(self._predicate)
27502753

27512754
@cached_property
@@ -2755,7 +2758,7 @@ def partition_filters(self) -> KeyDefaultDict[int, BooleanExpression]:
27552758
def _build_manifest_evaluator(self, spec_id: int) -> Callable[[ManifestFile], bool]:
27562759
schema = self._transaction.table_metadata.schema()
27572760
spec = self._transaction.table_metadata.specs()[spec_id]
2758-
return visitors.manifest_evaluator(spec, schema, self.partition_filters[spec_id], case_sensitive=True)
2761+
return manifest_evaluator(spec, schema, self.partition_filters[spec_id], case_sensitive=True)
27592762

27602763
def _build_partition_evaluator(self, spec_id: int) -> Callable[[DataFile], bool]:
27612764
schema = self._transaction.table_metadata.schema()
@@ -2764,9 +2767,7 @@ def _build_partition_evaluator(self, spec_id: int) -> Callable[[DataFile], bool]
27642767
partition_schema = Schema(*partition_type.fields)
27652768
partition_expr = self.partition_filters[spec_id]
27662769

2767-
return lambda data_file: visitors.expression_evaluator(partition_schema, partition_expr, case_sensitive=True)(
2768-
data_file.partition
2769-
)
2770+
return lambda data_file: expression_evaluator(partition_schema, partition_expr, case_sensitive=True)(data_file.partition)
27702771

27712772
def delete(self, predicate: BooleanExpression) -> None:
27722773
self._predicate = Or(self._predicate, predicate)
@@ -2785,8 +2786,8 @@ def _copy_with_new_status(entry: ManifestEntry, status: ManifestEntryStatus) ->
27852786
)
27862787

27872788
manifest_evaluators: Dict[int, Callable[[ManifestFile], bool]] = KeyDefaultDict(self._build_manifest_evaluator)
2788-
strict_metrics_evaluator = visitors._StrictMetricsEvaluator(schema, self._predicate, case_sensitive=True).eval
2789-
inclusive_metrics_evaluator = visitors._InclusiveMetricsEvaluator(schema, self._predicate, case_sensitive=True).eval
2789+
strict_metrics_evaluator = _StrictMetricsEvaluator(schema, self._predicate, case_sensitive=True).eval
2790+
inclusive_metrics_evaluator = _InclusiveMetricsEvaluator(schema, self._predicate, case_sensitive=True).eval
27902791

27912792
existing_manifests = []
27922793
total_deleted_entries = []
@@ -2800,9 +2801,9 @@ def _copy_with_new_status(entry: ManifestEntry, status: ManifestEntryStatus) ->
28002801
deleted_entries = []
28012802
existing_entries = []
28022803
for entry in manifest_file.fetch_manifest_entry(io=self._io):
2803-
if strict_metrics_evaluator(entry.data_file) == visitors.ROWS_MUST_MATCH:
2804+
if strict_metrics_evaluator(entry.data_file) == ROWS_MUST_MATCH:
28042805
deleted_entries.append(_copy_with_new_status(entry, ManifestEntryStatus.DELETED))
2805-
elif inclusive_metrics_evaluator(entry.data_file) == visitors.ROWS_CANNOT_MATCH:
2806+
elif inclusive_metrics_evaluator(entry.data_file) == ROWS_CANNOT_MATCH:
28062807
existing_entries.append(_copy_with_new_status(entry, ManifestEntryStatus.EXISTING))
28072808
else:
28082809
raise ValueError("Deletes do not support rewrites of data files")

0 commit comments

Comments
 (0)