Plain `none` from a grouping expression appears in `aggregate` output

Aperta
#7,599 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
databases

Direzione di ricerca

Start with the repro: run the aggregate query with count() by t:=a.ok() on the four-record input and compare with the values {t:a.ok()} form, which already drops the plain none field. The aggregate grouping-key handling is the place to look, and the type checker's none not handled error is the reference for how a possibly-none value is treated. Done means the grouping key of none no longer appears as a t:none row, or the query errors clearly, with a test covering the four-record input.

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

Descrizione

bug

When an aggregate grouping expression evaluates to a plain none (e.g., via ok()), the none is kept as the key value in the output. Per the approach described in #7584, a plain none that lands in a record field should disappear, and a query shouldn't output one. When asked about this, @mccanne said the none grouping expressions should disappear, or maybe be an error.

Details

Repro is with super commit 40ff9fb. This was spotted with the JSONBench bluesky data in the verification notes in https://github.com/superdb/super/issues/7479#issuecomment-6455141392, but it can be reproduced with a simple four-record input.

$ super -version &&
  super -c '
values {a:"x"},{a:"y"},{b:1},{a:"x"}
| aggregate count() by t:=a.ok()
| sort t'

Version: v0.4.0-17-g40ff9fbf5

{t:"x",count:2}
{t:"y",count:1}
{t:none,count:1}

Compare this with a record expression on the same input, where the plain none field disappears:

$ super -c '
values {a:"x"},{a:"y"},{b:1},{a:"x"}
| values {t:a.ok()}'

{t:"x"}
{t:"y"}
{}
{t:"x"}

Downstream, the type checker already treats t as possibly none. Adding | values t to the first query fails with none not handled (consider ?? or ?.), yet the record holding that none is output without complaint.

More detail from Claude is available in a Gist.

Lingua principale
Go
Stelle
1.6k
Fork
84
Merge medio
10h 14m
PR unite (30g)
150

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di superdb/super

Tutte le issue di superdb/super

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.