morningman commented on code in PR #63240:
URL: https://github.com/apache/doris/pull/63240#discussion_r3255167665


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java:
##########
@@ -459,4 +459,52 @@ public boolean hasSortOrder() {
         org.apache.iceberg.SortOrder sortOrder = table.sortOrder();
         return sortOrder != null && !sortOrder.isUnsorted();
     }
+
+    /** Reconstructs PARTITION BY LIST (...) () from the Iceberg PartitionSpec 
for SHOW CREATE TABLE. */
+    public String getPartitionSpecSql() {
+        makeSureInitialized();
+        Table table = getIcebergTable();
+        PartitionSpec spec = table.spec();
+        if (spec == null || spec.isUnpartitioned()) {
+            return "";
+        }
+        List<String> fields = new ArrayList<>();
+        for (PartitionField field : spec.fields()) {
+            String colName = table.schema().findColumnName(field.sourceId());
+            if (colName == null) {
+                continue;
+            }
+            org.apache.iceberg.transforms.Transform<?, ?> t = 
field.transform();
+            // isVoid/isIdentity: public interface methods; toString(): 
canonical spec-defined names.
+            if (t.isVoid()) {
+                continue;
+            } else if (t.isIdentity()) {
+                fields.add(colName);
+            } else {

Review Comment:
   @nsivarajan PTAL



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


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

Reply via email to