Jzjsnow commented on code in PR #3776: URL: https://github.com/apache/amoro/pull/3776#discussion_r2602695079
########## amoro-format-iceberg/src/main/java/org/apache/amoro/optimizing/evaluation/MetricBasedEvaluationEvent.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.amoro.optimizing.evaluation; + +import org.apache.amoro.TableFormat; +import org.apache.amoro.config.OptimizingConfig; +import org.apache.amoro.shade.guava32.com.google.common.annotations.VisibleForTesting; +import org.apache.amoro.table.MixedTable; +import org.apache.amoro.utils.MemorySize; +import org.apache.iceberg.Snapshot; +import org.apache.iceberg.SnapshotSummary; +import org.apache.iceberg.util.PropertyUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; + +public class MetricBasedEvaluationEvent { + private static final Logger logger = LoggerFactory.getLogger(MetricBasedEvaluationEvent.class); + + public static boolean isReachFallbackInterval(OptimizingConfig config, long lastPlanTime) { + long fallbackInterval = config.getEvaluationFallbackInterval(); + return fallbackInterval >= 0 && System.currentTimeMillis() - lastPlanTime > fallbackInterval; + } + + public static boolean isEvaluatingNecessary( + OptimizingConfig config, MixedTable table, long lastPlanTime) { + if (table.format() != TableFormat.ICEBERG && table.format() != TableFormat.MIXED_ICEBERG) { + logger.debug( + "MetricBasedRefreshEvent only support ICEBERG/MIXED_ICEBERG tables. Always return true for other table formats."); Review Comment: Thanks for pointing this out! This is indeed a typo in the log message and is fixed to align with the class name. -- 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]
