brucearctor opened a new issue, #14969:
URL: https://github.com/apache/gravitino/issues/14969

   ### Describe the feature
   
   Extend `catalogs/catalog-kafka` (and topic detail surfacing in `mcp-server`) 
with first-class property definitions, validation, and cross-catalog Iceberg 
table linkage metadata for AutoMQ Table Topics (`automq.table.topic.*`) 
materialized into Apache Iceberg catalogs (such as Gravitino's Iceberg REST 
server).
   
   ### Motivation
   
   Kafka-compatible streaming engines such as AutoMQ (1.5.x+) support **Table 
Topics**, which continuously materialize Kafka topic streams directly into 
Apache Iceberg tables via an Iceberg REST catalog—commonly backed by 
Gravitino's own Iceberg REST server and a `lakehouse-iceberg` catalog within 
the same Metalake.
   
   Currently, `catalog-kafka` only defines `partition-count` and 
`replication-factor` in `KafkaTopicPropertiesMetadata` and treats Kafka topics 
and their materialized Iceberg tables in `lakehouse-iceberg` as completely 
disconnected assets:
   - Users lack typed property descriptors, defaults, and validation when 
provisioning or altering Table Topics through Gravitino.
   - Governance consumers, lineage workflows, and AI/MCP clients querying 
Gravitino (`mcp-server`) have no standardized way to resolve which 
`<metalake>.<iceberg_catalog>.<namespace>.<table>` identifier corresponds to a 
given Table Topic.
   
   ### Describe the solution
   
   1. **First-Class Table Topic Property Descriptors & Validation 
(`KafkaTopicPropertiesMetadata`)**:
      - Define typed `PropertyEntry` metadata and validation rules for standard 
AutoMQ OSS Table Topic configurations:
        - `automq.table.topic.enable` (`boolean`, optional, default `false` 
when unset on standard topics)
        - `automq.table.topic.namespace` (`string`, target Iceberg 
namespace/schema when Table Topic is enabled)
        - `automq.table.topic.commit.interval.ms` (`long` > 0, snapshot commit 
interval in milliseconds)
        - `automq.table.topic.schema.type` (`string` enum validation, e.g., 
`schema`, `schemaless`)
        - `automq.table.topic.partition.by` (`string`, Iceberg partition 
transform expression list)
        - `automq.table.topic.upsert.enable` (`boolean`, upsert mode toggle)
        - `automq.table.topic.id.columns` (`string`, primary/identifier column 
list for upsert/CDC)
        - `automq.table.topic.cdc.field` (`string`, CDC operation field name)
      - Validate cross-property invariants during topic creation and alteration 
(for example, positive `automq.table.topic.commit.interval.ms`, valid 
`schema.type`, and requiring `automq.table.topic.namespace` when 
`automq.table.topic.enable=true` unless a catalog default namespace is 
configured).
   
   2. **Catalog & Topic Iceberg Linkage Metadata 
(`KafkaCatalogPropertiesMetadata` & `KafkaCatalogOperations`)**:
      - Add optional catalog-level linkage properties in 
`KafkaCatalogPropertiesMetadata`:
        - `table-topic.iceberg-catalog`: name of the target Iceberg catalog in 
the same Gravitino Metalake (e.g., a `lakehouse-iceberg` catalog backing 
Gravitino's Iceberg REST server).
        - `table-topic.default-namespace`: optional fallback Iceberg namespace 
when not explicitly set on the topic.
      - When loading, creating, or altering a topic with 
`automq.table.topic.enable=true` (including pre-existing Table Topics 
discovered from an AutoMQ broker), resolve and expose standardized read-only 
linkage metadata in the returned topic properties (e.g., resolved Iceberg 
catalog, namespace, table name, and full `NameIdentifier` 
`<metalake>.<iceberg_catalog>.<namespace>.<topic_name>`) without sending 
synthetic Gravitino-only keys to Kafka's `AdminClient`.
   
   3. **MCP Server Visibility (`mcp-server`)**:
      - Surface the resolved linked Iceberg table identifier clearly in 
`mcp-server` topic detail responses (`mcp_server/tools/topic.py`) so AI agents 
inspecting a Kafka catalog can traverse directly from a Table Topic to its 
materialized Iceberg table tools (`get_table_by_fqn`).
   
   4. **Testing**:
      - Unit tests for `KafkaTopicPropertiesMetadata`, 
`KafkaCatalogPropertiesMetadata`, `KafkaCatalogOperations` validation and 
Iceberg identifier linkage resolution, and `mcp-server` topic tool unit tests.
      - Integration tests verifying Table Topic property creation, alteration, 
validation errors, and end-to-end Iceberg table identifier resolution.
   
   ### Additional context
   
   - Fully backward-compatible with standard Apache Kafka brokers: when 
`automq.table.topic.*` properties are not set, `catalog-kafka` behavior is 
unchanged, and no non-Kafka synthetic properties are pushed to `AdminClient`.
   - Works seamlessly when AutoMQ's Iceberg catalog config points to 
Gravitino's Iceberg REST catalog endpoint.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to