wypoon commented on code in PR #12461: URL: https://github.com/apache/iceberg/pull/12461#discussion_r2027937054
########## hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java: ########## @@ -230,12 +190,14 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) { .collect(Collectors.toSet()); } - Map<String, String> summary = - Optional.ofNullable(metadata.currentSnapshot()) - .map(Snapshot::summary) - .orElseGet(ImmutableMap::of); - setHmsTableParameters( - newMetadataLocation, tbl, metadata, removedProps, hiveEngineEnabled, summary); + HMSTablePropertyHelper.updateHmsTableForIcebergView( Review Comment: This should be `updateHmsTableForIcebergTable`, ########## hive-metastore/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java: ########## @@ -0,0 +1,264 @@ +/* + * 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.iceberg.hive; + +import static org.apache.iceberg.TableProperties.GC_ENABLED; + +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import org.apache.hadoop.hive.common.StatsSetupConst; +import org.apache.hadoop.hive.metastore.api.Table; +import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; +import org.apache.iceberg.BaseMetastoreTableOperations; +import org.apache.iceberg.PartitionSpecParser; +import org.apache.iceberg.Schema; +import org.apache.iceberg.SchemaParser; +import org.apache.iceberg.Snapshot; +import org.apache.iceberg.SnapshotSummary; +import org.apache.iceberg.SortOrderParser; +import org.apache.iceberg.TableMetadata; +import org.apache.iceberg.TableProperties; +import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; +import org.apache.iceberg.relocated.com.google.common.collect.Maps; +import org.apache.iceberg.util.JsonUtil; +import org.apache.iceberg.view.ViewMetadata; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HMSTablePropertyHelper { + private static final Logger LOG = LoggerFactory.getLogger(HMSTablePropertyHelper.class); + private static final String HIVE_ICEBERG_STORAGE_HANDLER = + "org.apache.iceberg.mr.hive.HiveIcebergStorageHandler"; + + private static final Map<String, String> ICEBERG_TO_HMS_TRANSLATION = + ImmutableMap.of( + // gc.enabled in Iceberg and external.table.purge in Hive are meant to do the same things + // but with different names + GC_ENABLED, "external.table.purge"); Review Comment: I suggested this before and I'll suggest it again: I think that it would be valuable to preserve a small part of the javadoc for `HiveTableOperations.translateToIcebergProp` which is removed in this PR, and add it as a comment before this static field: "Provides key translation where necessary between Iceberg and HMS props. This translation is needed because some properties control the same behaviour but are named differently in Iceberg and Hive." Then the inner comment about gc.enabled and external.table.purge is not needed, as it would be clear. At the moment, there is only one property that needs translation, and the inner comment explains why we currently do this translation. It is conceivable that in future, more properties may need translation. Having a comment explaining the reason for the Map is better than an inner comment explaining why gc.enabled needs translation. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org