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

Open Beginner friendly
#492 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go

Research direction

Start with appendColumnValues in internal/sink/iceberg.go, where the issue says missing or unparsable values are appended as null without checking Required. Trace how the Iceberg writer handles nulls for required fields and find the related tests. Done means a record missing a required value is rejected or reported instead of appearing as a normal row with 0, with behavior covered by a test.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Go
Stars
59
Forks
16
Avg merge
5h 46m
Merged PRs (30d)
121

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from KafScale/platform

All issues in KafScale/platform

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.