You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Federico Valeri (Jira)" <ji...@apache.org> on 2025/12/24 13:23:00 UTC

[jira] [Created] (KAFKA-20020) Improve UUID nullability description in API readme

Federico Valeri created KAFKA-20020:
---------------------------------------

             Summary: Improve UUID nullability description in API readme
                 Key: KAFKA-20020
                 URL: https://issues.apache.org/jira/browse/KAFKA-20020
             Project: Kafka
          Issue Type: Bug
          Components: documentation
    Affects Versions: 4.1.1
            Reporter: Federico Valeri


The Nullable Fields section in the Kafka message protocol readme can make people think that they can declare nullable a field of type Uuid:

{code}
Booleans, ints, and floats can never be null.  However, fields that are strings,
bytes, uuid, records, or arrays may optionally be "nullable".  When a field is
"nullable", that simply means that we are prepared to serialize and deserialize
null entries for that field.
...
If a field is declared as non-nullable, and it is present in the message
version you are using, you should set it to a non-null value before serializing
the message.  Otherwise, you will get a runtime error.
{code}

This is not possible by design as the UUIDFieldType class does NOT override canBeNullable(), so it inherits the default implementation which returns false. Uuid fields use a special zero uuid value (all bits set to 0) as a sentinel to represent "no UUID" instead of null.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)