morningman commented on code in PR #55679: URL: https://github.com/apache/doris/pull/55679#discussion_r2329332014
########## fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/action/IcebergRewriteDataFilesAction.java: ########## @@ -0,0 +1,86 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.datasource.iceberg.action; + +import org.apache.doris.catalog.TableIf; +import org.apache.doris.common.DdlException; +import org.apache.doris.common.UserException; +import org.apache.doris.datasource.iceberg.IcebergExternalTable; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.plans.commands.info.PartitionNamesInfo; + +import java.util.Map; +import java.util.Optional; + +/** + * Iceberg rewrite data files action implementation. + * This action rewrites data files in Iceberg tables to optimize file sizes + * and improve query performance. + */ +public class IcebergRewriteDataFilesAction extends BaseIcebergAction { + public static final String TARGET_FILE_SIZE = "target_file_size"; + public static final String MIN_INPUT_FILES = "min_input_files"; + + public IcebergRewriteDataFilesAction(Map<String, String> properties, + Optional<PartitionNamesInfo> partitionNamesInfo, + Optional<Expression> whereCondition, + IcebergExternalTable icebergTable) { + super("rewrite_data_files", properties, partitionNamesInfo, whereCondition, icebergTable); + } + + @Override + protected void validateIcebergAction() throws UserException { + // Validate target_file_size parameter + if (properties.containsKey(TARGET_FILE_SIZE)) { + try { + long targetFileSize = Long.parseLong(properties.get(TARGET_FILE_SIZE)); + if (targetFileSize <= 0) { + throw new DdlException("target_file_size must be positive"); + } + } catch (NumberFormatException e) { + throw new DdlException("Invalid target_file_size format: " + properties.get(TARGET_FILE_SIZE)); + } + } + + // Validate min_input_files parameter + if (properties.containsKey(MIN_INPUT_FILES)) { + try { + int minInputFiles = Integer.parseInt(properties.get(MIN_INPUT_FILES)); + if (minInputFiles < 1) { + throw new DdlException("min_input_files must be at least 1"); + } + } catch (NumberFormatException e) { + throw new DdlException("Invalid min_input_files format: " + properties.get(MIN_INPUT_FILES)); + } + } + + // Iceberg procedures don't support partitions or where conditions + validateNoPartitions(); + validateNoWhereCondition(); Review Comment: I think rewrite action should support partition and where ########## fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/action/IcebergRewriteDataFilesAction.java: ########## @@ -0,0 +1,86 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.datasource.iceberg.action; + +import org.apache.doris.catalog.TableIf; +import org.apache.doris.common.DdlException; +import org.apache.doris.common.UserException; +import org.apache.doris.datasource.iceberg.IcebergExternalTable; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.plans.commands.info.PartitionNamesInfo; + +import java.util.Map; +import java.util.Optional; + +/** + * Iceberg rewrite data files action implementation. + * This action rewrites data files in Iceberg tables to optimize file sizes + * and improve query performance. + */ +public class IcebergRewriteDataFilesAction extends BaseIcebergAction { + public static final String TARGET_FILE_SIZE = "target_file_size"; + public static final String MIN_INPUT_FILES = "min_input_files"; Review Comment: No `MIN_FILE_SIZE_MB ` and `MAX_FILE_SIZE_MB `? See: https://www.dremio.com/blog/optimizing-iceberg-tables/ -- 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]
