apache / apache/iceberg-python
SqlCatalog table operations should filter on `iceberg_type`
- 主要语言
- Python
- 星标
- 1.1k
- 派生
- 581
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 78
描述
### 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 :/
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
从 SqlCatalog 的表操作方法入手,将它们的谓词与 #3263 中 list_tables 现有的 iceberg_type 处理进行比较,并使用提供的 SQLite 设置和视图行重现该问题。完成标准是:load_table、drop_table、rename_table 和 commit_table 不再将 iceberg_type VIEW 的行视为表,同时 TABLE 和 NULL 行仍能正常工作。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python, sql
- 领域
- databases
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 68/100