dengzhhu653 commented on code in PR #5523:
URL: https://github.com/apache/hive/pull/5523#discussion_r1847526328


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/metasummary/TablePropertySummary.java:
##########
@@ -0,0 +1,182 @@
+/*
+ * 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.metasummary;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.metastore.metasummary.MetadataTableSummary;
+import org.apache.hadoop.hive.metastore.metasummary.SummaryMapBuilder;
+import org.apache.iceberg.BaseTable;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.TableMetadata;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
+
+/**
+ * Collect the summary based on the table's properties.
+ * It could be the version, write mode or compression, etc.
+ */
+public class TablePropertySummary extends IcebergSummaryRetriever {
+  private static final String VERSION = "version";
+  private static final String WRITE_WAP_PROPERTY = "write.wap.enabled";
+  private List<PropertyRetriever> retrievers;
+
+  @Override
+  public void initialize(Configuration conf, boolean formatJson) {
+    super.initialize(conf, formatJson);
+    this.retrievers = Arrays.asList(
+        new WriteFormatSummary(),
+        new DistributionModeSummary(),
+        new UpdateModeSummary());
+  }
+
+  @Override
+  public List<String> getFieldNames() {
+    List<String> fields = Lists.newArrayList();
+    fields.add(VERSION);
+    retrievers.forEach(propertyRetriever -> 
fields.addAll(propertyRetriever.getFieldNames()));
+    fields.add(WRITE_WAP_PROPERTY);
+    return fields;
+  }
+
+  @Override
+  public void getMetaSummary(Table table, MetadataTableSummary summary) {
+    Map<String, String> properties = table.properties();
+    retrievers.forEach(propertyRetriever ->
+        propertyRetriever.getMetaSummary(properties, summary));
+    TableMetadata metadata = ((BaseTable) table).operations().current();
+    assert metadata != null;

Review Comment:
   yes, it has been caught in the upper caller: 
   
https://github.com/apache/hive/blob/4f3fed3b5b78f52a2a784783646e9397a7a9443d/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/metasummary/IcebergSummaryHandler.java#L132-L135
   
   If we don't collect the Iceberg summary successfully, then it will be marked 
as dropped and not displayed to the user.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to