Avoid re-evaluating expressions in filters and projections
- Lenguaje dominante
- Rust
- Estrellas
- 9.3k
- Forks
- 2.4k
- Merge medio
- 3 d 11 h
- PR fusionados (30 d)
- 362
Descripción
This patterns shows up pretty often:
```sql
select expensive(col)
from t
where expensive(col)
```
A pathological case is variant / json:
```sql
select variant_get(col, 'key')
from t
from variant_get(col, 'key')
```
There's two issues here:
1. Until we solve projection pushdown (https://github.com/apache/datafusion/issues/14993) if `key` is not shredded we materialize the entire `col` and then extract `key` in a `ProjectionExec`.
2. Even once that is resolved, or in the case that `key` is not shredded evaluating `variant_get(col, 'key')` itself is expensive we still re-compute `variant_get(col, 'key')` twice: once for the filter and once for the projection.
Guía de contribución
Línea de trabajo
Comienza leyendo el comportamiento de filtrado y proyección descrito en los ejemplos de SQL, incluidos ProjectionExec y el issue de projection-pushdown #14993. Determina cómo se representan y evalúan las expresiones repetidas, como variant_get(col, 'key'), y define la finalización como evitar la evaluación duplicada preservando al mismo tiempo los resultados de la consulta.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rust, sql
- Área
- data-engineering, databases
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100