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

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 12d1cf13606 branch-4.1: [iceberg](fix) Fetch comment PROP from table 
meta #64263 (#64308)
12d1cf13606 is described below

commit 12d1cf13606a5d4549cbcd51125215d546f61690
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jun 17 09:55:16 2026 +0800

    branch-4.1: [iceberg](fix) Fetch comment PROP from table meta #64263 
(#64308)
    
    Cherry-picked from #64263
    
    Co-authored-by: Gabriel <[email protected]>
---
 .../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 e8db8a30ef4..cdfd574b8e6 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