diff --git a/databases/kafka.mdx b/databases/kafka.mdx index 39ab1b4..d035a7a 100644 --- a/databases/kafka.mdx +++ b/databases/kafka.mdx @@ -148,8 +148,10 @@ through the log, one page older each time. Row counts are approximate. The count is the end offset minus the start offset, which overcounts where retention has removed messages from the middle of a compacted topic. -Schema Registry is not read. A topic whose values are Avro or Protobuf shows the raw bytes, -including the five-byte Confluent wire-format prefix. +Schema Registry is not read. A binary `value` column of Protobuf messages decodes field by field +with **Display As > Protobuf**, which reads the five-byte Confluent wire-format prefix and shows the +schema ID; see [Binary value viewer](/features/json-viewer#binary-value-viewer). Avro values show +as raw bytes. Creating a topic, editing topic configuration, and resetting consumer group offsets are not available. Deleting a topic is, as the paragraph above describes. diff --git a/features/json-viewer.mdx b/features/json-viewer.mdx index 1eabe49..2d97ef0 100644 --- a/features/json-viewer.mdx +++ b/features/json-viewer.mdx @@ -1,6 +1,6 @@ --- title: Cell and Row Viewers -description: View and edit JSON, PHP serialized, image and binary cell values, set per-column display formats, and inspect whole rows in the sidebar +description: View and edit JSON, PHP serialized, image and binary cell values, decode MessagePack and Protobuf, set per-column display formats, and inspect whole rows in the sidebar --- Click the chevron on a JSON or blob cell to open its value in a popover anchored to that cell. Which viewer opens follows the column: its declared type, or the **Display As** choice on its header, and that choice changes rendering only, never what is stored. @@ -16,10 +16,12 @@ Right-click a column header and pick **Display As**. The submenu lists the forma | Raw Value | all | Shows the stored value, and turns off detection for that column | | Text | binary | Reads the bytes as UTF-8, trailing `BINARY(N)` padding trimmed | | UUID | binary, text | Renders 16 raw bytes or a 32-digit hex string as a hyphenated UUID | +| UUID (Swapped Time) | binary | Renders 16 bytes written by MySQL's `UUID_TO_BIN(uuid, 1)` as the UUID passed in | | Unix Timestamp (seconds) | integer | Renders the number as a formatted date | | Unix Timestamp (milliseconds) | integer | Same, treating the number as milliseconds | | JSON | text | Opens the cell in the JSON viewer | | PHP Serialized | text | Opens the cell in the PHP serialized viewer | +| MessagePack, Protobuf | binary | Decodes the bytes and opens the cell in the [binary value viewer](#binary-value-viewer) | An override persists per column, scoped to the connection and table. A column with a format set copies in that format when you copy the single cell; a block of cells or a whole row always copies the stored value. @@ -27,6 +29,8 @@ Id-like binary and character columns, integer columns whose names read as timest **Text** decides per cell, not per column: an image or a hash sitting in a column set to **Text** still reads as `0x89504E…`. The cell edits as hex either way. +**Generate UUID**, **Fill Column** and a new row's key write the bytes in the order the column shows them, so a value generated under **UUID (Swapped Time)** reads back as the UUID it shows. + ## JSON viewer A JSON-typed column opens on the chevron; double-click or `Enter` edits it inline instead. A text column holding JSON needs **Display As > JSON** first. @@ -91,10 +95,24 @@ Reading an element does not change it. Only an element whose JSON you alter is r Set **Display As > PHP Serialized** on a text column, then double-click or press `Enter`. The viewer is read-only: PHP serialized values round-trip through PHP itself. -**Tree** mode is the JSON tree with PHP's types: it filters, [selects, copies](#selecting-and-copying-in-a-tree) and draws [links and color swatches](#links-and-color-swatches) the same way, with type badges on the nodes (`str`, `int`, `arr`, `obj`, `ser`, `ref`) and visibility badges on object members (`protected`, `private (ClassName)`). A custom-serialized class (the `C:` token) is one opaque leaf that copies as its whole payload, and a reference (`r:`/`R:`) shows as `→ #N` and is not followed. **Raw** mode shows the original string with text selection. +**Tree** mode is the JSON tree with PHP's types: it filters, [selects, copies](#selecting-and-copying-in-a-tree) and draws [links and color swatches](#links-and-color-swatches) the same way, with type badges on the nodes (`str`, `int`, `arr`, `obj`, `ser`, `enum`, `ref`) and visibility badges on object members (`protected`, `private (ClassName)`). A custom-serialized class (the `C:` token) is one opaque leaf that copies as its whole payload, an enum case (`E:`) reads `Suit::Hearts`, and a reference (`r:`/`R:`) shows as `→ #N` and is not followed. **Raw** mode shows the original string with text selection. An array or object row copies as its summary, such as `[2 items]`, not as its contents, so each row you select inside it copies its own value after the summary. Copy the serialized text from **Raw** mode instead. +## Binary value viewer + +Set **Display As > MessagePack** or **Protobuf** on a binary column. The grid shows each value decoded on one line, and double-click or `Enter` opens the viewer. It is read-only. On an editable table the chevron still opens the hex editor, and so does double-clicking a NULL cell. + +| Mode | MessagePack | Protobuf | +| --- | --- | --- | +| **Tree** | The [JSON tree](#selecting-and-copying-in-a-tree), with `bin`, `ext` and `time` badges for the types JSON lacks | Field numbers, badged with the wire type: `varint`, `i32`, `i64`, `len` or `group` | +| **Text** | JSON. Bytes as `0x` hex, an extension as `ext(5) 0x…`, a timestamp in UTC | Text format, as `protoc --decode_raw` prints it | +| **Hex** | The stored bytes | The stored bytes | + +Protobuf without its schema has no field names or types. A length-delimited field reads as a nested message when its bytes parse as one, else as text when they are UTF-8, else as escaped bytes, so a short string can read as a message. A value that starts with a Schema Registry frame, as Kafka producers write it, shows its schema ID and message index above the tree. + +A value that does not decode stays hex in the grid, and the viewer says where it broke above its hex dump. Copying a single cell copies the decoded text, cut at 40,000 characters. **Find** searches the decoded text. + ## Blob and hex A blob cell renders in the grid as compact hex (`0x48656C…`), unless its column reads as text. Click the chevron or double-click for the popover: a classic hex dump with offset, byte columns, and ASCII, plus an editable hex field under it on an editable table. That field takes spaced or continuous hex, with or without a `0x` prefix, and invalid hex disables **Save**. @@ -126,6 +144,9 @@ A value that refuses to open in one mode still opens in another. | JSON tree | 100,000 characters, indentation not counted | "JSON Too Large". Read it in Text mode | | JSON and PHP trees | 5,000 nodes | The first 5,000 load, and a `…` row marks the cut | | PHP serialized | 5,000,000 characters, 256 levels deep | Tree shows a placeholder, Raw still works | +| MessagePack, Protobuf | 5,000,000 bytes; 256 levels deep, 100 for Protobuf | The cell stays hex, and the viewer says why | +| Decoded binary in the grid | 40,000 characters | The text ends in `…` | +| Decoded binary in **Text** mode | 500,000 characters | The text ends in `…` | | Hex dump and hex editor | 10 KB | The dump is truncated, and the editor opens read-only | | Blob cell in the grid | First 64 bytes | Rendered as `0x48656C…` | | Image preview | 16 MB | "Too Large to Preview". The source still opens | @@ -141,6 +162,7 @@ A value that refuses to open in one mode still opens in another. | A spatial column whose value the map reads, or GeoJSON in a JSON column | [Map](#geometry-fields), stored value behind **Text** | | A JSON column, or text that parses as JSON | JSON editor | | A PHP serialized value | Read-only [PHP viewer](#php-serialized-viewer) | +| A binary column set to MessagePack or Protobuf | Read-only [binary value viewer](#binary-value-viewer) | | An image, in any column | [Image viewer](#image-viewer), source behind the second segment | | An enum, set, or boolean column | Picker | | A blob column, or other bytes in a spatial column | Hex editor | @@ -158,7 +180,7 @@ The hex editor shows the first 10 KB of a blob. Past that it reads **Truncated, The text box, the JSON editor and the map each carry a drag handle under them, with separate remembered heights that survive a relaunch. -**Open in Window** detaches a JSON, PHP or text value into its own resizable window; on an editable row, edits there join the same pending changes as the field. An image and a map detach read-only. The text window's status bar counts the value's characters, as the Unicode code points `CHAR_LENGTH` counts, and its bytes in UTF-8, and warns when the value holds a bidirectional control that can reorder how the text reads. The expand button on a JSON, PHP, long text or geometry field grows it to fill the inspector's height with the other fields still listed around it; click it again to shrink it back. Binary and image fields draw at a fixed height and carry no expand button, and neither does a geometry field stored as bytes, whose map still takes the drag handle. +**Open in Window** detaches a JSON, PHP, decoded binary or text value into its own resizable window; on an editable row, edits there join the same pending changes as the field. An image and a map detach read-only. The text window's status bar counts the value's characters, as the Unicode code points `CHAR_LENGTH` counts, and its bytes in UTF-8, and warns when the value holds a bidirectional control that can reorder how the text reads. The expand button on a JSON, PHP, decoded binary, long text or geometry field grows it to fill the inspector's height with the other fields still listed around it; click it again to shrink it back. Binary and image fields draw at a fixed height and carry no expand button, and neither does a geometry field stored as bytes, whose map still takes the drag handle. Every field carries a menu at its trailing edge, and right-clicking the field opens the same one. **Set NULL**, **Set DEFAULT**, **Set EMPTY**, **Generate UUID**, **Generate UUIDv7** and **SQL Functions** need an editable field and appear only where the column takes them, as in [Set Value](/features/change-tracking#editing-a-cell); `Ctrl+Option+N` and `Ctrl+Option+D` set NULL and DEFAULT from the keyboard. **Copy Value** is always there, and a read-only field keeps its text selectable.