Skip to content

Tables ​

A table is a Kafka topic added with mink table add. It has the topic's name and lives in the kafka namespace by default. Its schema grows as producers register new schema versions.

Columns ​

Every table starts with these columns, in this order.

ColumnTypeValue
_kafka_partitionintThe Kafka partition
_kafka_offsetlongThe record's offset
_kafka_timestamptimestamptzThe record's timestamp, in microseconds
_kafka_keybinaryThe raw key, or null when the key is null or decoded
_kafka_headerslist<struct<key: string, value: binary>>Every header in order, repeats kept
_kafka_valuebinaryThe raw value, or null when the value is null or decoded

A topic written with Schema Registry schemas gets more columns after these.

ColumnTypeValue
_kafka_decoded_keyThe key schema's typeThe decoded key
One per top-level field of the value schemaThe field's typeThe field's value
valueThe value schema's typeThe decoded value, when the value schema is not a record, message or object

Schema Registry ​

Mink reads the schema id the way Confluent's and AWS Glue's serializers write it.

FormatWhere
Header__key_schema_id or __value_schema_id, holding byte 1 and the schema's GUID. The header wins over a prefix.
Glue prefixByte 3, the compression byte (0 none, 5 zlib), then the schema version UUID as 16 bytes, then the payload
Confluent prefixByte 0, then the schema id as 4 bytes, then the payload

A part without a schema id, with a schema Mink cannot read, or with bytes that do not decode keeps its raw bytes in _kafka_key or _kafka_value, and its typed columns are null.

Without a schema_registry setting, new records keep their raw bytes.

Avro ​

AvroIceberg
boolean, int, long, float, doubleSame
bytes, stringbinary, string
recordstruct
enumstring
array, maplist, map<string, …>
fixed of size nfixed[n]
Union of null and one typeThat type, optional
decimal(p, s), p <= 38decimal(p, s)
uuid, dateuuid, date
time-millis, time-microstime
timestamp-millis, timestamp-microstimestamptz
local-timestamp-millis, local-timestamp-microstimestamp
timestamp-nanos, local-timestamp-nanoslong, nanoseconds
durationfixed[12]
Other unions, decimal with p > 38, recursive recordsstring, as JSON

Protobuf ​

ProtobufIceberg
bool, float, double, string, bytesboolean, float, double, string, binary
int32, sint32, sfixed32int
int64, sint64, sfixed64, uint32, fixed32long
uint64, fixed64decimal(20, 0)
enumstring
messagestruct
repeated, map<K, V>list, map
oneofOne field per member
google.protobuf.Timestamptimestamptz
Wrapper types such as Int64ValueThe wrapped type
Any, Struct, Value, ListValue, Duration, recursive messagesstring, as JSON

The schema's first message is the table's. Records written with another message of the schema keep their raw bytes.

JSON Schema ​

JSON SchemaIceberg
boolean, stringboolean, string
integer, numberlong, double
string with format date-time, date, uuidtimestamptz, date, uuid
object with propertiesstruct
object with only additionalPropertiesmap<string, …>
array with one items schemalist
enum of stringsstring
One type and nullThat type, optional
$refThe definition's type
oneOf, anyOf, allOf, several types, no type, recursive definitionsstring, as JSON

Schema evolution ​

A new schema version is merged into the table the first time a record uses it. Columns are never dropped, so every file reads under the current schema.

ChangeResult
Field unchangedSame column
int to long, float to double, wider decimal precisionThe column is promoted
Any other type changeA new column takes the name. The old column stays as {name}_s{N}, where N is the last schema it was current in.
New fieldA new optional column at the end of its struct
Field removedThe column stays, null for new records

A schema Mink cannot merge leaves its records with their raw bytes, for example one with a field named after a Mink column or a column Iceberg reserves. The exact rules are in schema.md and decoding.md.

States ​

StateMeaning
indexingIndexed, committed and served
missingKafka no longer has the topic. Back to indexing when the topic returns.
replacedThe topic was deleted and created again. Remove the table and add it again.
removingRemoved. Its objects and rows are deleted once its leases expire.

Only indexing tables are listed by the catalog.