apache / apache/iceberg-python
SqlCatalog table operations should filter on `iceberg_type`
- Ngôn ngữ chính
- Python
- Star
- 1.1k
- Fork
- 581
- Merge trung bình
- 1 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 77
Mô tả
### Feature Request / Improvement
In #3263, the `iceberg_type` column was added to the SQLCatalog and filters it in `list_tables`, but the other table operations (i.e. load_table, drop_table, rename_table, commit_table) don't check it yet. That means a view row written by iceberg java or iceberg-rust can bleed in pythons SQLCatalog table operations.
Java's V1 catalog applies `WHERE (iceberg_type = 'TABLE' OR iceberg_type IS NULL)` everywhere ([JdbcUtil.java#L168](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/jdbc/JdbcUtil.java#L168)). We should do the same.
Probably worth extracting a small helper since the predicate would now appear in ~5+ places.
Repro steps:
```python
catalog = SqlCatalog("test", uri="sqlite:///...", warehouse="...")
catalog.create_namespace("ns")
# bypass and sim java/rust writing a view row
with catalog.engine.connect() as conn:
conn.execute(text(
"INSERT INTO iceberg_tables VALUES "
"('test', 'ns', 'a_view', 's3://fake/m.json', NULL, 'VIEW')"
))
conn.commit()
catalog.drop_table(("ns", "a_view")) # Silently deletes the view row :/
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu trong các phương thức thao tác bảng của SqlCatalog, so sánh các vị từ của chúng với cách xử lý iceberg_type hiện có trong list_tables từ #3263, rồi tái hiện vấn đề bằng thiết lập SQLite và hàng view được cung cấp. Công việc được xem là hoàn tất khi load_table, drop_table, rename_table và commit_table không còn coi các hàng có iceberg_type VIEW là bảng, trong khi các hàng TABLE và NULL vẫn tiếp tục hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python, sql
- Lĩnh vực
- databases
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 68/100