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

Gabriel39 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 716365826ed [iceberg](fix) Fetch comment PROP from table meta (#64263)
716365826ed is described below

commit 716365826edff6092c4c0abcd2956e7dea09343b
Author: Gabriel <[email protected]>
AuthorDate: Tue Jun 9 17:44:01 2026 +0800

    [iceberg](fix) Fetch comment PROP from table meta (#64263)
    
    Goal and tests: The PR adds Iceberg external table comment retrieval from 
Iceberg table/view properties and covers table comment, escaping, and 
missing-comment behavior with a unit test.
---
 .../doris/datasource/iceberg/IcebergExternalTable.java  | 13 +++++++++++++
 .../datasource/iceberg/IcebergExternalTableTest.java    | 17 ++++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
index f96ea825a54..d621b24d102 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java
@@ -25,6 +25,7 @@ import org.apache.doris.catalog.PartitionItem;
 import org.apache.doris.catalog.PartitionType;
 import org.apache.doris.common.AnalysisException;
 import org.apache.doris.common.DdlException;
+import org.apache.doris.common.util.SqlUtils;
 import org.apache.doris.common.util.Util;
 import org.apache.doris.datasource.ExternalTable;
 import org.apache.doris.datasource.SchemaCacheKey;
@@ -75,6 +76,7 @@ public class IcebergExternalTable extends ExternalTable 
implements MTMVRelatedTa
     private boolean isValidRelatedTable = false;
     private boolean isView;
     private static final String ENGINE_PROP_NAME = "engine-name";
+    private static final String TABLE_COMMENT_PROP = "comment";
 
     public IcebergExternalTable(long id, String name, String remoteName, 
IcebergExternalCatalog catalog,
             IcebergExternalDatabase db) {
@@ -146,6 +148,17 @@ public class IcebergExternalTable extends ExternalTable 
implements MTMVRelatedTa
         return IcebergUtils.getIcebergTable(this);
     }
 
+    @Override
+    public String getComment() {
+        return properties().getOrDefault(TABLE_COMMENT_PROP, "");
+    }
+
+    @Override
+    public String getComment(boolean escapeQuota) {
+        String comment = getComment();
+        return escapeQuota ? SqlUtils.escapeQuota(comment) : comment;
+    }
+
     @Override
     public void beforeMTMVRefresh(MTMV mtmv) throws DdlException {
     }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergExternalTableTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergExternalTableTest.java
index 2d1e7a390ae..6bb96bf0d43 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergExternalTableTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergExternalTableTest.java
@@ -259,6 +259,22 @@ public class IcebergExternalTableTest {
         return spy;
     }
 
+    @Test
+    public void testGetComment() {
+        IcebergExternalTable spy = createSpyTable();
+        Map<String, String> properties = Maps.newHashMap();
+        properties.put("comment", "my-table-comment");
+        Mockito.when(icebergTable.properties()).thenReturn(properties);
+
+        Assertions.assertEquals("my-table-comment", spy.getComment());
+
+        properties.put("comment", "comment with \"quote\"");
+        Assertions.assertEquals("comment with \\\"quote\\\"", 
spy.getComment(true));
+
+        properties.remove("comment");
+        Assertions.assertEquals("", spy.getComment());
+    }
+
     /** Creates a mock Transform with the given canonical toString() value.
      *  Also stubs isIdentity() and isVoid() based on the value. */
     @SuppressWarnings({"unchecked", "rawtypes"})
@@ -398,4 +414,3 @@ public class IcebergExternalTableTest {
         Assertions.assertEquals("", spy.getPartitionSpecSql());
     }
 }
-


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to