apache / apache/iceberg-python
SqlCatalog table operations should filter on `iceberg_type`
- Langage dominant
- Python
- Étoiles
- 1.1k
- Forks
- 581
- Merge moyen
- 1 j 17 h
- PR mergées (30 j)
- 78
Description
### 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 :/
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par les méthodes d’opérations sur les tables de SqlCatalog, comparez leurs prédicats avec la gestion existante de iceberg_type dans list_tables de #3263, puis reproduisez le problème avec la configuration SQLite et la ligne de vue fournies. Le travail est terminé lorsque load_table, drop_table, rename_table et commit_table ne traitent plus les lignes dont iceberg_type vaut VIEW comme des tables, tandis que les lignes TABLE et NULL continuent de fonctionner.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python, sql
- Domaine
- databases
- Type d'issue
- Fonctionnalité
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 68/100