Nested coalesce
- Lingua principale
- Rust
- Stelle
- 9.3k
- Fork
- 2.4k
- Merge medio
- 3g 11h
- PR unite (30g)
- 360
Descrizione
### Is your feature request related to a problem or challenge?
`coalsece` currently does not support structs. If it would however, I think it should only consider top-level NULLs, so `coalsece(NULL, {a: 1, b: NULL}, {a: 2, b: 3}) = {a: 1, b: NULL}`. However sometimes it would be handy to fill in fields recursively. So `coalsece_nested(NULL, {a: 1, b: NULL}, {a: 2, b: 3}) = {a: 1, b: 3}`
### Describe the solution you'd like
Have a `coalesce` variant that supports structs by traversing them recursively. So:
```sql
coalesce_nested(
NULL,
{
a: 1,
b: NULL,
c: NULL,
d: NULL,
},
{
a: 2,
b: NULL,
c: {a: NULL},
d: {a: 2, b: NULL},
},
{
a: 3,
b: NULL,
c: NULL,
d: {a: 3, b: 3},
},
)
=
{
a: 1,
b: NULL,
c: {a: NULL},
d: {a: 2, b: 3},
}
```
### Describe alternatives you've considered
\-
### Additional context
A user that fully knows the type could manually construct this using `coalesce` and `named_struct` (proposed in #5861).
#### Prior art:
- [PostgresQL `pg_rowalesce` extension](https://pgxn.org/dist/pg_rowalesce/)
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia tracciando la funzione coalesce esistente e la funzionalità named_struct menzionata nella issue, quindi esamina come DataFusion rappresenta e valuta i valori struct. Usa gli esempi SQL come verifiche comportamentali; il lavoro è completato quando una variante di coalesce riempie ricorsivamente i campi NULL degli struct preservando i risultati mostrati a livello superiore e annidato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust, sql
- Ambito
- 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