Iceberg processor writes 0 into a required column when the record has no value for it

Aperta Adatta ai principianti
#492 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à
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
go

Direzione di ricerca

Inizia da appendColumnValues in internal/sink/iceberg.go, dove l’issue indica che i valori mancanti o non analizzabili vengono aggiunti come null senza verificare Required. Segui come il writer Iceberg gestisce i valori null per i campi obbligatori e trova i test correlati. Il lavoro è concluso quando un record a cui manca un valore obbligatorio viene rifiutato o segnalato, invece di apparire come una normale riga con 0, e un test copre questo comportamento.

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

Descrizione

The Iceberg processor writes records that have no value for a required: true column. The column is NOT NULL in the table, so the missing value lands as 0 instead of the record being rejected or reported.

Steps

  1. Map a topic with a required column, for example:

    mappings:
      - topic: orders
        table: kafscale.orders
        mode: append
        create_table_if_missing: true
        schema:
          columns:
            - {name: order_id, type: long, required: true}
            - {name: status, type: string}
    
  2. Produce one record that is not JSON (value hello) and some valid JSON records such as {"order_id":1,"status":"paid"}.

  3. Query the table.

Expected

The record without order_id is not written as a normal row (skipped and counted, or the batch fails), or the docs say what happens.

Actual

KafScale v2.2.0 (fc9ed22), schema mode off:

record_id   order_id  status  value
orders:3:0  0         NULL    r2
orders:1:0  0         NULL    hello

DESCRIBE shows order_id bigint not null. appendColumnValues in internal/sink/iceberg.go calls appendNull() for a missing or unparsable value without checking Required, and the writer turns the null into 0 for the required field. Readers cannot tell a missing order_id from a real 0.

Lingua principale
Go
Stelle
59
Fork
16
Merge medio
5h 46m
PR unite (30g)
121

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 KafScale/platform

Tutte le issue di KafScale/platform

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.