TDIGEST_GENERATE_SKETCH fails with "Duplicate field name" after TDIGEST_QUANTILE on the same input

Aperta Adatta ai principianti
#20,819 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java, sql
Ambito
analytics

Direzione di ricerca

Inizia da TDigestGenerateSketchSqlAggregator, dove il ciclo riutilizza una TDigestSketchAggregatorFactory esistente con lo stesso input e la stessa compressione. Chi ha segnalato il problema ha rilevato che riutilizzare la factory creata da a0:agg di TDIGEST_QUANTILE aggiunge un nome di campo duplicato. Aggiungi la prima query della issue a TDigestSketchSqlAggregatorTest e verifica che fallisca con 'Duplicate field name: a0:agg'. È completato quando quella query e le varianti in ordine inverso vengono pianificate e restituiscono risultati senza errori, e i test esistenti continuano a passare.

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

Descrizione

Contributions Welcome
Affected Version

master (checked at a311ccd1c4). The code involved comes from #8100, so older versions are probably affected too, but I haven't tested them.

Description

Found while working on #20782.

A query that calls TDIGEST_QUANTILE and then TDIGEST_GENERATE_SKETCH on the same input fails at planning time:

SELECT TDIGEST_QUANTILE(m1, 0.5), TDIGEST_GENERATE_SKETCH(m1) FROM foo
Duplicate field name: a0:agg

From what I tried, it happens when both functions get the same input and compression and TDIGEST_QUANTILE comes first:

Query Result
TDIGEST_QUANTILE(m1, 0.5), TDIGEST_GENERATE_SKETCH(m1) fails
TDIGEST_QUANTILE(m1 * 2, 0.5), TDIGEST_GENERATE_SKETCH(m1 * 2) fails
TDIGEST_QUANTILE(m1, 0.5, 200), TDIGEST_GENERATE_SKETCH(m1, 200) fails
TDIGEST_QUANTILE(m1, 0.5), TDIGEST_GENERATE_SKETCH(m1, 200) works
TDIGEST_GENERATE_SKETCH(m1), TDIGEST_QUANTILE(m1, 0.5) works

TDigestGenerateSketchSqlAggregator looks for an existing TDigestSketchAggregatorFactory with the same input and compression, and returns it as its own aggregation. If TDIGEST_QUANTILE came first, that factory is the quantile's a0:agg, so it is added twice and Grouping rejects the duplicate name. In the reverse order TDIGEST_QUANTILE reuses the sketch through its post-aggregator, which is fine. I tried removing the reuse loop locally as an experiment, and all of the queries above planned without errors.

To reproduce, add a test with the first query to TDigestSketchSqlAggregatorTest.

I'd like to work on a fix.

Lingua principale
Java
Stelle
14.1k
Fork
3.8k
Merge medio
2g 1h
PR unite (30g)
225

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 apache/druid

Tutte le issue di apache/druid

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.