RyanLin5967 opened a new issue, #4186:
URL: https://github.com/apache/iceberg-python/issues/4186
### Apache Iceberg version
0.12.0 (latest release)
### Please describe the bug 🐞
Currently, `entries()` builds `column_sizes` with
`dict(entry.data_file.column_sizes)`, so an entry without that optional field
raises `TypeError`. `files()` handles it, and #1902 added `or {}` to the three
count columns beside it for #1884.
```python
import os, tempfile
import pyarrow as pa, pyarrow.parquet as pq
from pyiceberg.catalog.sql import SqlCatalog
from pyiceberg.manifest import DataFile, DataFileContent, FileFormat
from pyiceberg.typedef import Record
d = tempfile.mkdtemp()
cat = SqlCatalog("c", uri="sqlite:///:memory:", warehouse=f"file://{d}")
cat.create_namespace("ns")
t = cat.create_table("ns.t", schema=pa.schema([("x", pa.int64())]))
pq.write_table(pa.table({"x": [1]}), f"{d}/a.parquet")
f = DataFile.from_args(content=DataFileContent.DATA,
file_path=f"file://{d}/a.parquet", file_format=FileFormat.PARQUET,
partition=Record(), record_count=1,
file_size_in_bytes=os.path.getsize(f"{d}/a.parquet"))
with t.transaction() as tx:
with tx.update_snapshot().fast_append() as fa:
fa.append_data_file(f)
t.inspect.entries()
# TypeError: 'NoneType' object is not iterable, should be one row with
column_sizes None
```
DuckDB 1.5.6 leaves `column_sizes` out of the data and delete files it
writes, so `entries()` fails on tables it wrote.
tested on pyiceberg 0.12.0 and main
### Willingness to contribute
- [ ] I can contribute a fix for this bug independently
- [ ] I would be willing to contribute a fix for this bug with guidance from
the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
--
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]