Skip to content

SQL: Query decoded keys and headers on Iceberg topics - #658

Open
kbatuigas wants to merge 4 commits into
mainfrom
DOC-2338-sql-document-feature-read-message-keys-and-head
Open

SQL: Query decoded keys and headers on Iceberg topics#658
kbatuigas wants to merge 4 commits into
mainfrom
DOC-2338-sql-document-feature-read-message-keys-and-head

Conversation

@kbatuigas

@kbatuigas kbatuigas commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request adds support for decoding record keys and header values when querying Iceberg-enabled topics with Redpanda SQL. Users can now specify how keys and headers are decoded and exposed in query results by setting new options on CREATE TABLE. Documentation is updated to describe these options, their effects, and usage examples.

New SQL options for key and header decoding:

Documentation and usage examples:

Resolves https://github.com/redpanda-data/documentation-private/issues/
Review deadline:

Page previews

Checks

  • New feature
  • Content gap
  • Support Follow-up
  • Small fix (typos, links, copyedits, etc)

@kbatuigas
kbatuigas requested a review from a team as a code owner July 31, 2026 00:42
@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for rp-cloud ready!

Name Link
🔨 Latest commit 8b959cf
🔍 Latest deploy log https://app.netlify.com/projects/rp-cloud/deploys/6a6bef5e338ee6000845d1bb
😎 Deploy Preview https://deploy-preview-658--rp-cloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Documents SQL support for querying decoded keys and header values from Iceberg-enabled topics. It adds CREATE TABLE options for decoding modes, schemas, wire protocols, and header types; explains validation, metadata types, errors, and immutability; and provides configuration and query examples. An August 2026 release note summarizes the feature.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: feediver1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the documentation changes and follows the template, though the issue number, review deadline, previews, and check selection remain incomplete.
Title check ✅ Passed The title is concise, specific, and accurately summarizes the primary change: querying decoded keys and headers on Iceberg topics.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DOC-2338-sql-document-feature-read-message-keys-and-head

Comment @coderabbitai help to get the list of available commands.

@kbatuigas kbatuigas changed the title Doc 2338 sql document feature read message keys and head SQL: Query decoded keys and headers on Iceberg topics Jul 31, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@modules/reference/pages/sql/sql-statements/create-table.adoc`:
- Around line 163-164: Revise the paragraph describing raw key and header values
so it states that key_decode_mode enables decoding, while key_schema_subject,
key_schema_message_full_name, and key_confluent_wire_protocol only configure
schema-mode decoding. Clarify that header_value_type controls header decoding,
and avoid implying auxiliary schema options alone change metadata types.
- Around line 91-94: Resolve the contradictory description for
key_schema_message_full_name in the CREATE TABLE option reference by checking
the implementation’s behavior and documenting either that the option is required
for schemas with multiple messages or that it defaults to the first message.
Update the column description so it states only the implemented rule and removes
the conflicting fallback or requirement.

In `@modules/sql/pages/query-data/query-iceberg-topics.adoc`:
- Around line 134-141: Update the CREATE TABLE example for
default_redpanda_catalog=>orders to set header_value_type to 'string', so the
subsequent (redpanda).headers query returns decoded string values and matches
the surrounding description.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 00f17fc7-cfce-4e4e-b96b-8fb766f02875

📥 Commits

Reviewing files that changed from the base of the PR and between 38e0176 and 8b959cf.

📒 Files selected for processing (3)
  • modules/get-started/pages/whats-new-cloud.adoc
  • modules/reference/pages/sql/sql-statements/create-table.adoc
  • modules/sql/pages/query-data/query-iceberg-topics.adoc

Comment on lines +91 to +94
|`key_schema_message_full_name`
|STRING
|No
|Full Protobuf message name for the key schema. Required when the key schema defines more than one message. Defaults to the first message in the schema.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Resolve the contradictory Protobuf key message-name rule.

Line 94 says key_schema_message_full_name is required for multi-message schemas, then says it defaults to the first message. Choose one behavior and align it with the implementation; otherwise users may omit a required option or rely on an ambiguous message selection.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/reference/pages/sql/sql-statements/create-table.adoc` around lines 91
- 94, Resolve the contradictory description for key_schema_message_full_name in
the CREATE TABLE option reference by checking the implementation’s behavior and
documenting either that the option is required for schemas with multiple
messages or that it defaults to the first message. Update the column description
so it states only the implemented rule and removes the conflicting fallback or
requirement.

Comment on lines +163 to +164
By default, `key` is raw `bytea` and each header `value` is raw `bytea`. To decode them, set `key_decode_mode`, `key_schema_subject`, `key_confluent_wire_protocol`, or `header_value_type` (see <<options>>):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clarify which options actually enable decoding.

key_decode_mode selects the decoding mode; key_schema_subject, key_schema_message_full_name, and key_confluent_wire_protocol only provide schema-mode configuration. Reword this paragraph so users do not assume setting an auxiliary option alone changes the metadata type.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/reference/pages/sql/sql-statements/create-table.adoc` around lines
163 - 164, Revise the paragraph describing raw key and header values so it
states that key_decode_mode enables decoding, while key_schema_subject,
key_schema_message_full_name, and key_confluent_wire_protocol only configure
schema-mode decoding. Clarify that header_value_type controls header decoding,
and avoid implying auxiliary schema options alone change metadata types.

Comment on lines +134 to +141
CREATE TABLE default_redpanda_catalog=>orders WITH (
topic = 'orders',
schema_subject = 'orders-value',
key_decode_mode = 'schema_id_prefix'
);

SELECT ((redpanda).key).customer_id, (redpanda).headers
FROM default_redpanda_catalog=>orders;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the example actually decode headers.

The CREATE TABLE statement configures only key_decode_mode, while header_value_type defaults to binary. Therefore (redpanda).headers still contains raw bytea values, despite the preceding text saying the example accesses decoded key and header values. Add header_value_type = 'string' or change the prose to describe headers as raw bytes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/sql/pages/query-data/query-iceberg-topics.adoc` around lines 134 -
141, Update the CREATE TABLE example for default_redpanda_catalog=>orders to set
header_value_type to 'string', so the subsequent (redpanda).headers query
returns decoded string values and matches the surrounding description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant