Misplaced Cloud SharedSet branch calls a method through a null storage pointer in CollectSets

Aperta Adatta ai principianti
#135,811 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Leggi src/Planner/CollectSets.cpp intorno a CollectSetsVisitor::enterImpl (righe 87–144) e segui i rami storage_set e ConstantNode. Controlla il percorso degli insiemi letterali descritto nell’issue e sposta la gestione di SharedSet in modo che acceda solo a uno storage non nullo. Il lavoro è completato quando gli operandi letterali raggiungono addFromTuple senza chiamare un metodo di storage e il caso speciale è limitato a un operando storage non nullo.

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

Descrizione

comp-query-analyzer potential bug
Describe what's wrong

The CLICKHOUSE_CLOUD branch in CollectSetsVisitor::enterImpl calls storage_set->getName inside the literal ConstantNode branch, where storage_set is necessarily null: the preceding if (storage_set) branch was not taken. The Cloud-specific SharedSet handling appears to have been inserted before addFromTuple instead of alongside the non-null storage handling.

Source: https://github.com/ClickHouse/ClickHouse/blob/3c475c66f2d5b5baa125f3cf4c40765e4e8febc1/src/Planner/CollectSets.cpp#L87-L144

How to reproduce

Build with CLICKHOUSE_CLOUD=1 and follow a nonconstant left operand with a literal right operand through CollectSetsVisitor::enterImpl, for example:

SELECT number FROM numbers(3) WHERE number IN (0, 2);

On the first collection of the literal set, second_argument_table and storage_set are null, findTuple misses, and the Cloud-only block invokes getName through the null pointer. This is a code-reading reproducer of undefined behavior, not a reproduced server termination.

Expected behavior

Literal operands should reach addFromTuple without invoking a storage method. The SharedSet special case should only inspect a non-null storage operand.

Validation and affected versions

This was found while reviewing the literal-set path of a separate PR. Public builds set CLICKHOUSE_CLOUD=0, so the Fast test binary cannot exercise the offending block. The public StorageSet is also final and its inline getName returns a constant, so compiler devirtualization may hide the runtime symptom. Private overlay behavior and affected deployed/released versions have not been verified; no affected-version label is inferred.

The misplaced block was introduced by commit ba3d3f4535f6bc42827cc67c3f439c5c0ee381de and remains in the public source. No matching public tracking issue or fix was found.

Caused by: https://github.com/ClickHouse/ClickHouse/pull/104248
Related: https://github.com/ClickHouse/ClickHouse/pull/133454

Lingua principale
C++
Stelle
51.1k
Fork
9.3k
Merge medio
19h 45m
PR unite (30g)
524

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

Tutte le issue di ClickHouse/ClickHouse

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.