apache / apache/iceberg-python

Add `CAST` to `parser.py`

Abierto
#198 7 comentarios 0 reacciones 0 asignados Ver en GitHub
stale
Lenguaje dominante
Python
Estrellas
1.1k
Forks
581
Merge medio
1 d 17 h
PR fusionados (30 d)
78

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Empieza con parser.py y el contexto de issue 170. Sigue la clase Reference existente y las acciones de análisis, y después sigue cómo las expresiones analizadas llegan al scan y cómo las cadenas se convierten en valores de IcebergType. La tarea está terminada cuando se analiza la sintaxis CAST y su tipo de destino se propaga al scan.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
databases
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.