apache / apache/iceberg-python
Add `CAST` to `parser.py`
- Langage dominant
- Python
- Étoiles
- 1.1k
- Forks
- 581
- Merge moyen
- 1 j 17 h
- PR mergées (30 j)
- 78
Description
### Feature Request / Improvement
I think I have somewhat of an idea on how to do this, so far have added the following to `parser.py`:
```py
CAST = CaselessKeyword("cast")
cast_expression = (CAST + "(" + column + "as" + identifier + Suppress(")")).set_results_name("cast")
# would need something special for the set_parse_action
```
I am wondering a couple of things:
Do we need a new class `CastableReference` or something? Worth expanding on the `Reference` class? And once that is done, how would we propagate the new type (Im assuming we need some way to go from a string to an `IcebergType` of the string the user has put into the cast operation) into the scan?
This was spawned from https://github.com/apache/iceberg-python/issues/170
Happy to work on this, just would be awesome to get some context
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par parser.py et le contexte de issue 170. Suivez la classe Reference existante et les actions d’analyse, puis suivez comment les expressions analysées atteignent le scan et comment les chaînes deviennent des valeurs IcebergType. C’est terminé lorsque la syntaxe CAST est analysée et que son type cible est propagé au scan.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- databases
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Active
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100