apache / apache/iceberg-python

Add `CAST` to `parser.py`

Aperta
#198 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub
stale
Lingua principale
Python
Stelle
1.1k
Fork
581
Merge medio
1g 17h
PR unite (30g)
78

Descrizione

### 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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.