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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/action/IcebergRewriteDataFilesAction.java:
##########
@@ -132,14 +149,69 @@ protected List<Column> getResultSchema() {
 
     @Override
     protected void validateIcebergAction() throws UserException {
-        // TODO: Implement validation logic for rewrite_data_files parameters
+        // Validate min and max file size parameters
+        long targetFileSizeBytes = 
namedArguments.getLong(TARGET_FILE_SIZE_BYTES);
+        // min-file-size-bytes default to 75% of target file size
+        this.minFileSizeBytes = namedArguments.getLong(MIN_FILE_SIZE_BYTES);
+        if (this.minFileSizeBytes == 0) {
+            this.minFileSizeBytes = (long) (targetFileSizeBytes * 0.75);
+        }
+        // max-file-size-bytes default to 180% of target file size
+        this.maxFileSizeBytes = namedArguments.getLong(MAX_FILE_SIZE_BYTES);
+        if (this.maxFileSizeBytes == 0) {
+            this.maxFileSizeBytes = (long) (targetFileSizeBytes * 1.8);
+        }
+        validateNoPartitions();
     }
 
     @Override
     protected List<String> executeAction(TableIf table) throws UserException {
-        // TODO: Implement the logic to rewrite data files in the Iceberg table
-        // For now, just return dummy values
-        return Lists.newArrayList("0", "1", "2", "3");
+        try {
+            Table icebergTable = 
IcebergUtils.getIcebergTable((IcebergExternalTable) table);
+
+            if (icebergTable.currentSnapshot() == null) {
+                LOG.info("Table {} has no data, skipping rewrite", 
table.getName());
+                return Lists.newArrayList("0", "0", "0", "0");

Review Comment:
   add comment



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