datafusion-proto: decoding an AvroScan node without the avro feature panics

Aperta Adatta ai principianti
#26,998 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à
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
databases

Direzione di ricerca

Il panic è il ramo #[cfg(not(feature = "avro"))] per AvroScan in datafusion/proto/src/physical_plan/mod.rs, intorno alle righe 1238-1247. Copia il ramo ParquetScan appena sopra, che restituisce not_impl_err! per lo stesso caso. È completato quando la decodifica di un nodo AvroScan con le funzionalità predefinite restituisce Err invece di andare in panic, cosa che un nuovo test compilato senza la funzionalità avro può verificare.

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

Descrizione

Describe the bug

datafusion-proto is built without avro by default, since its default features are ["parquet"]. In that build, PhysicalPlanNode::try_into_physical_plan panics on an AvroScan node:

https://github.com/apache/datafusion/blob/934691e9af8f11bf4b629f21bb17795abfb84d93/datafusion/proto/src/physical_plan/mod.rs#L1238-L1247

#[cfg(not(feature = "avro"))]
panic!(
    "Unable to process a Avro PhysicalPlan when `avro` feature is not enabled"
)

The ParquetScan arm just above it handles the same situation with not_impl_err!:

https://github.com/apache/datafusion/blob/934691e9af8f11bf4b629f21bb17795abfb84d93/datafusion/proto/src/physical_plan/mod.rs#L1228-L1237

The same code is in 55.1.0, src/physical_plan/mod.rs, lines 1100-1108.

To Reproduce

Build datafusion-proto with default features, then decode a PhysicalPlanNode whose physical_plan_type is AvroScan(Default::default()):

let node = protobuf::PhysicalPlanNode {
    physical_plan_type: Some(protobuf::physical_plan_node::PhysicalPlanType::AvroScan(Default::default())),
};
let _ = datafusion_proto::bytes::physical_plan_from_bytes(&node.encode_to_vec(), &ctx.task_ctx());

The arm is an unconditional panic!, so this panics before the node's contents are looked at.

Expected behavior

Return not_impl_err!, as the ParquetScan arm does, so a caller gets Err and keeps running.

Additional context

This matters wherever a process decodes plans it did not encode itself. One example is a distributed worker that receives plan stages from peers. A few bytes of input panic the decoding task, and under panic = "abort" they stop the whole process.

A fix is one line, plus a decode test with the feature off. I can open the PR if that is welcome.

Lingua principale
Rust
Stelle
9.6k
Fork
2.6k
Merge medio
4g 11h
PR unite (30g)
322

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.