Uh oh!
There was an error while loading. Please reload this page.
Add ResidualVisitor to compute residuals - #1388
Conversation
…y-op add count in data scan and test in catalog sql
Uh oh!
There was an error while loading. Please reload this page.
jayceslesar
commented
Dec 2, 2024
Question: Does it make sense to expose this as the |
Residual Evaluator with test
* added residual evaluator in plan files * tested counts with positional deletes * merged main
Uh oh!
There was an error while loading. Please reload this page.
* added residual evaluator in plan files * tested counts with positional deletes * merged main * implemented batch reader in count * breaking integration test * fixed integration test * git pull main * revert * revert * revert test_partitioning_key.py * revert test_parser.py * added residual evaluator in visitor * deleted residual_evaluator.py * removed test count from test_sql.py * ignored lint type * fixed lint * working on plan_files * type ignored * make lint
tusharchou
commented
Jan 6, 2025
Hi @Fokko@kevinjqliu@gli-chris-hao , I have implemented these suggestions with my best understanding.
It would be helpful to get fresh review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
* added residual evaluator in plan files * tested counts with positional deletes * merged main * implemented batch reader in count * breaking integration test * fixed integration test * git pull main * revert * revert * revert test_partitioning_key.py * revert test_parser.py * added residual evaluator in visitor * deleted residual_evaluator.py * removed test count from test_sql.py * ignored lint type * fixed lint * working on plan_files * type ignored * make lint * explicit delete files len is zero * residual eval only if manifest is true * default residual is always true * used projection schema * refactored residual in plan files * fixed lint issue with isnan * simplified count if else conditions * implemented refactoring comments on residual visitor
Sometime I'm seeing this: ``` ImportError while loading conftest '/home/runner/work/iceberg-python/iceberg-python/tests/conftest.py'. tests/conftest.py:52: in <module> from pyiceberg.catalog import Catalog, load_catalog pyiceberg/catalog/__init__.py:51: in <module> from pyiceberg.serializers import ToOutputFile pyiceberg/serializers.py:25: in <module> from pyiceberg.table.metadata import TableMetadata, TableMetadataUtil pyiceberg/table/__init__.py:65: in <module> from pyiceberg.io.pyarrow import ArrowScan, schema_to_pyarrow pyiceberg/io/pyarrow.py:141: in <module> from pyiceberg.table.locations import load_location_provider pyiceberg/table/locations.py:25: in <module> from pyiceberg.table import TableProperties E ImportError: cannot import name 'TableProperties' from partially initialized module 'pyiceberg.table' (most likely due to a circular import) (/home/runner/work/iceberg-python/iceberg-python/pyiceberg/table/__init__.py) ``` Also observed in: apache#1388 I prefer the imports at the top, but I think this is a small price to pay to avoid having circular imports.
Sometime I'm seeing this: ``` ImportError while loading conftest '/home/runner/work/iceberg-python/iceberg-python/tests/conftest.py'. tests/conftest.py:52: in <module> from pyiceberg.catalog import Catalog, load_catalog pyiceberg/catalog/__init__.py:51: in <module> from pyiceberg.serializers import ToOutputFile pyiceberg/serializers.py:25: in <module> from pyiceberg.table.metadata import TableMetadata, TableMetadataUtil pyiceberg/table/__init__.py:65: in <module> from pyiceberg.io.pyarrow import ArrowScan, schema_to_pyarrow pyiceberg/io/pyarrow.py:141: in <module> from pyiceberg.table.locations import load_location_provider pyiceberg/table/locations.py:25: in <module> from pyiceberg.table import TableProperties E ImportError: cannot import name 'TableProperties' from partially initialized module 'pyiceberg.table' (most likely due to a circular import) (/home/runner/work/iceberg-python/iceberg-python/pyiceberg/table/__init__.py) ``` Also observed in: #1388 I prefer the imports at the top, but I think this is a small price to pay to avoid having circular imports.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Fokko
left a comment
There was a problem hiding this comment.
deftest_fokko(session_catalog):
importpyarrow.parquetaspqdf=pq.read_table("/Users/fokko.driesprong/Downloads/yellow_tripdata_2024-01.parquet")
session_catalog.drop_table("default.taxis")
tbl=session_catalog.create_table("default.taxis", schema=df.schema)
withtbl.update_spec() asspec:
spec.add_field("tpep_pickup_datetime", DayTransform())
tbl.append(df)
# tbl = session_catalog.load_table("default.taxis")pred=LessThan("tpep_pickup_datetime", datetime.datetime(2024, 1, 3, 12, 0, 0))
cnt=tbl.scan(row_filter=pred).count()
assertcnt==len(df.filter(expression_to_pyarrow(pred.bind(tbl.schema()))))Works very well:

Uh oh!
There was an error while loading. Please reload this page.
Fokko
commented
Feb 11, 2025
Thanks @tusharchou for working on this 🚀 |
mrutunjay-kinagi
commented
Feb 11, 2025
🚀 |
closes issue: Count rows as a metadata-only operation #1223