This is an automated email from the ASF dual-hosted git repository.

davidzollo pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new f47b0bea5c [Fix][API] Support dotted opaque table names (#11220)
f47b0bea5c is described below

commit f47b0bea5c8649448f34edb47e7b3d2bedabb815
Author: Jast <[email protected]>
AuthorDate: Wed Jul 1 20:44:46 2026 +0800

    [Fix][API] Support dotted opaque table names (#11220)
---
 .../seatunnel/api/table/catalog/TablePathTest.java | 31 ++++++++++++++++++++++
 .../seatunnel/kafka/source/KafkaSourceConfig.java  |  9 ++++++-
 .../kafka/source/KafkaSourceConfigTest.java        | 24 +++++++++++++++++
 3 files changed, 63 insertions(+), 1 deletion(-)

diff --git 
a/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/catalog/TablePathTest.java
 
b/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/catalog/TablePathTest.java
new file mode 100644
index 0000000000..e6244f185c
--- /dev/null
+++ 
b/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/catalog/TablePathTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.api.table.catalog;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class TablePathTest {
+
+    @Test
+    public void testRejectMalformedStructuredTableNameWithTooManyParts() {
+        Assertions.assertThrows(
+                IllegalArgumentException.class,
+                () -> TablePath.of("reg.country.user_activity.activity"));
+    }
+}
diff --git 
a/seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceConfig.java
 
b/seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceConfig.java
index 017325f057..249030c736 100644
--- 
a/seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceConfig.java
+++ 
b/seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceConfig.java
@@ -312,10 +312,17 @@ public class KafkaSourceConfig implements Serializable {
                         
.orElse(ReadonlyConfig.fromMap(Collections.emptyMap()));
 
         return schema.getOptional(TableIdentifierOptions.TABLE)
-                .map(TablePath::of)
+                .map(KafkaSourceConfig::parseKafkaTablePath)
                 .orElseGet(() -> TablePath.of(null, topicName));
     }
 
+    private static TablePath parseKafkaTablePath(String tableName) {
+        if (StringUtils.countMatches(tableName, ".") > 2) {
+            return TablePath.of(null, tableName);
+        }
+        return TablePath.of(tableName);
+    }
+
     private DeserializationSchema<SeaTunnelRow> createDeserializationSchema(
             CatalogTable catalogTable, ReadonlyConfig readonlyConfig) {
         SeaTunnelRowType seaTunnelRowType = catalogTable.getSeaTunnelRowType();
diff --git 
a/seatunnel-connectors-v2/connector-kafka/src/test/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceConfigTest.java
 
b/seatunnel-connectors-v2/connector-kafka/src/test/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceConfigTest.java
index e550c99590..2a3b63a944 100644
--- 
a/seatunnel-connectors-v2/connector-kafka/src/test/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceConfigTest.java
+++ 
b/seatunnel-connectors-v2/connector-kafka/src/test/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceConfigTest.java
@@ -107,4 +107,28 @@ public class KafkaSourceConfigTest {
 
         Assertions.assertNotNull(deserializationSchema);
     }
+
+    @Test
+    void testSchemaTableWithMultipleDotsCanBeUsedAsOpaqueTablePath() {
+        String table = "reg.country.user_activity.activity";
+
+        Map<String, Object> schemaFields = new HashMap<>();
+        schemaFields.put("id", "int");
+        schemaFields.put("name", "string");
+
+        Map<String, Object> schema = new HashMap<>();
+        schema.put("fields", schemaFields);
+        schema.put(TABLE.key(), table);
+
+        Map<String, Object> configMap = new HashMap<>();
+        configMap.put("bootstrap.servers", "localhost:9092");
+        configMap.put("group.id", "test");
+        configMap.put("topic", "test");
+        configMap.put("schema", schema);
+        configMap.put("format", "json");
+
+        KafkaSourceConfig sourceConfig = new 
KafkaSourceConfig(ReadonlyConfig.fromMap(configMap));
+
+        
Assertions.assertNotNull(sourceConfig.getMapMetadata().get(TablePath.of(null, 
table)));
+    }
 }

Reply via email to