apache / apache/datafusion

Avoid re-evaluating expressions in filters and projections

Aperta
#17,599 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
9.3k
Fork
2.4k
Merge medio
3g 11h
PR unite (30g)
362

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia leggendo il comportamento di filtro e proiezione descritto negli esempi SQL, inclusi ProjectionExec e il problema di projection-pushdown #14993. Determina come vengono rappresentate e valutate le espressioni ripetute, come variant_get(col, 'key'), quindi definisci il completamento come l'evitare valutazioni duplicate preservando i risultati della query.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust, sql
Ambito
data-engineering, databases
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.