Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`CoalescePartitionsExec::cardinality_effect` returns `Equal` when `fetch` is set

Aperta Adatta ai principianti
#26,050 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@asolimando ci sta già lavorando.

Dal 5/10/2026.

  • #26051 di @asolimando — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
databases

Direzione di ricerca

Inizia individuando CoalescePartitionsExec::cardinality_effect e i test esistenti per quell'operatore; confrontane il comportamento con SortExec e SortPreservingMergeExec quando fetch è impostato. Aggiungi o aggiorna i test per i casi con e senza fetch e conferma che gli effetti riportati sono rispettivamente LowerEqual e Equal.

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

Descrizione

Describe the bug

CoalescePartitionsExec::cardinality_effect always returns CardinalityEffect::Equal, which is documented as "the operator is guaranteed to produce exactly one row for each input row". When fetch is set, the operator can produce fewer rows than its input, so it should return CardinalityEffect::LowerEqual, as SortExec and SortPreservingMergeExec already do when they have a fetch.

Any code that relies on cardinality_effect gets the wrong answer for this operator. For example, PassthroughStatisticsProvider returns the input statistics unchanged for operators with CardinalityEffect::Equal, so a CoalescePartitionsExec with fetch = 10 over 1000 rows reports Exact(1000) instead of Exact(10).

To Reproduce
let plan = CoalescePartitionsExec::new(input).with_fetch(Some(10));
assert!(matches!(plan.cardinality_effect(), CardinalityEffect::LowerEqual)); // fails: Equal
Expected behavior

cardinality_effect returns CardinalityEffect::LowerEqual when fetch is set, and CardinalityEffect::Equal otherwise.

Additional context

Other readers of cardinality_effect are the physical optimizer rules sort_pushdown, topk_aggregation and limit_pushdown_past_window. I did not find a query that returns wrong results because of this, and no sqllogictest plan changes with the fix.

Lingua principale
Rust
Stelle
9.4k
Fork
2.5k
Merge medio
4g 1h
PR unite (30g)
376

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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/datafusion

Tutte le issue di apache/datafusion

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.