`SELECT *` fails after a column is added until the next write to the table

Aperta
#42 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
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust, sql
Ambito
backend, databases

Direzione di ricerca

Start by reproducing the query after the schema-only column addition, then read crates/datafusion/src/table/mod.rs at the provider declarations and iceberg-rust's TableScanBuilder::build, which binds scans to the snapshot schema. Done means the fresh provider can run SELECT * and return the existing value with NULL for the newly added column without a new table write.

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

Descrizione

bug
Describe the bug

IcebergTableProvider and IcebergStaticTableProvider::try_new_from_table declare the table's current schema (table/mod.rs#L94-L97, table/mod.rs#L258-L262). iceberg-rust's scan binds the projection and filters to the schema of the snapshot it reads instead: TableScanBuilder::build uses snapshot.schema(...). After a schema change that has no snapshot of its own, the provider declares columns the scan can't find.

To Reproduce
  1. Create t(a INT NOT NULL) and insert one row.
  2. Add an optional column c STRING, for example with Transaction::update_schema().add_column(AddColumn::optional("c", ...)) or with ALTER TABLE ... ADD COLUMN from Spark. Don't write any new data.
  3. Build a fresh provider and run SELECT * FROM t:
DataInvalid => Column c not found in table. Schema: table {
  1: a: required int
}
Expected behavior

The query returns a = 1, c = NULL.

Additional context

The root cause is the iceberg-rust scan behavior tracked in apache/iceberg-rust#2565 and apache/iceberg-rust#2905. Until that's fixed upstream, this crate could declare the scanned snapshot's schema, or fill columns missing from it with nulls.

Lingua principale
Rust
Stelle
30
Fork
30
Merge medio
3g 19h
PR unite (30g)
15

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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-iceberg

Tutte le issue di apache/datafusion-iceberg

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.