zhangshenghang commented on code in PR #10175:
URL: https://github.com/apache/seatunnel/pull/10175#discussion_r2610907847


##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisCatalogIT.java:
##########
@@ -254,6 +255,58 @@ void testSaveMode() {
                 BasicType.DOUBLE_TYPE, 
newTable.getTableSchema().getColumns().get(4).getDataType());
     }
 
+    @Test
+    void testCreateTableWithUnboundedStringColumn() {
+        TableSchema.Builder builder = TableSchema.builder();
+        builder.column(PhysicalColumn.of("k1", BasicType.INT_TYPE, 10L, false, 
0, "k1"));
+        // Simulate upstream catalog (such as KuduCatalog) where string column 
has no logical
+        // length, so Doris should create it as STRING instead of CHAR(16).
+        builder.column(
+                PhysicalColumn.of(
+                        "k2",
+                        BasicType.STRING_TYPE,
+                        (Long) null,
+                        false,
+                        null,
+                        "k2 without length"));
+        builder.primaryKey(PrimaryKey.of("pk_k1", 
Collections.singletonList("k1")));
+
+        CatalogTable upstreamTable =
+                CatalogTable.of(
+                        TableIdentifier.of("doris", 
TablePath.of("test.unbounded_string")),
+                        builder.build(),
+                        Collections.emptyMap(),
+                        Collections.emptyList(),
+                        null);
+
+        ReadonlyConfig config =
+                ReadonlyConfig.fromMap(
+                        new HashMap<String, Object>() {
+                            {
+                                put(
+                                        DorisBaseOptions.FENODES.key(),
+                                        container.getHost() + ":" + HTTP_PORT);
+                                put(DorisBaseOptions.DATABASE.key(), "test");
+                                put(DorisBaseOptions.TABLE.key(), 
"unbounded_string");
+                                put(DorisBaseOptions.USERNAME.key(), USERNAME);
+                                put(DorisBaseOptions.PASSWORD.key(), PASSWORD);
+                            }
+                        });
+
+        CatalogTable createdTable =
+                assertCreateTable(upstreamTable, config, 
"test.unbounded_string");
+        Column createdStringColumn = 
createdTable.getTableSchema().getColumns().get(1);
+        Assertions.assertEquals("k2", createdStringColumn.getName());
+        // Ensure that the target column is mapped to Doris STRING type, not 
CHAR(16) / VARCHAR(16)
+        // inferred from a fake length.
+        Assertions.assertEquals(BasicType.STRING_TYPE, 
createdStringColumn.getDataType());
+        Assertions.assertEquals(
+                "string", 
createdStringColumn.getSourceType().toLowerCase(Locale.ROOT));
+        if (createdStringColumn.getColumnLength() != null) {
+            Assertions.assertTrue(createdStringColumn.getColumnLength() > 16L);

Review Comment:
   It should be a fixed value



-- 
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