saihemanth-cloudera commented on code in PR #5523: URL: https://github.com/apache/hive/pull/5523#discussion_r1847309874
########## standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/metasummary/MetadataTableSummary.java: ########## @@ -0,0 +1,249 @@ +/* + * 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.hadoop.hive.metastore.metasummary; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class MetadataTableSummary { + private String dbName; + private String tblName; + private String owner; + private int colCount; + private int partitionColumnCount; + private int partitionCount; + private long totalSize; + private long numRows; + private long numFiles; + private String tableType; + private String fileFormat; + private String compressionType; + private int arrayColumnCount; + private int structColumnCount; + private int mapColumnCount; + private Map<String, Object> summary; + private transient boolean dropped = false; + + public MetadataTableSummary(String owner, String db, String tableName) { + this.owner = owner; + this.dbName = db; + this.tblName = tableName; + } + + public MetadataTableSummary() { + } + + public MetadataTableSummary columnSummary(int columnCount, + int arrayColCount, int structColCount, int mapColCount) { + this.colCount = columnCount; + this.arrayColumnCount = arrayColCount; + this.structColumnCount = structColCount; + this.mapColumnCount = mapColCount; + return this; + } + + public MetadataTableSummary partitionSummary(int partColCount, int partCount) { + this.partitionCount = partCount; + this.partitionColumnCount = partColCount; + return this; + } + + public MetadataTableSummary tableFormatSummary(String tblType, String compression, String fileFormat) { + this.tableType = tblType; + this.compressionType = compression; + this.fileFormat = fileFormat; + return this; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this. owner = owner; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getTblName() { + return tblName; + } + + public void setTblName(String tblName) { + this.tblName = tblName; + } + + public int getColCount() { + return colCount; + } + + public void setColCount(int colCount) { + this.colCount = colCount; + } + + public int getPartitionColumnCount() { + return partitionColumnCount; + } + + public void setPartitionColumnCount(int partitionColumnCount) { + this.partitionColumnCount = partitionColumnCount; + } + + public int getPartitionCount() { + return partitionCount; + } + + public void setPartitionCount(int partitionCount) { + this.partitionCount = partitionCount; + } + + public long getTotalSize() { + return totalSize; + } + + public void setTotalSize(long totalSize) { + this.totalSize = totalSize; + } + + public long getNumRows() { + return numRows; + } + + public void setNumRows(long numRows) { + this.numRows = numRows; + } + + public long getNumFiles() { + return numFiles; + } + + public void setNumFiles(long numFiles) { + this.numFiles = numFiles; + } + + public String getTableType() { + return tableType; + } + + public void setTableType(String tableType) { + this.tableType = tableType; + } + + public String getFileFormat() { + return fileFormat; + } + + public void setFileFormat(String fileFormat) { + this.fileFormat = fileFormat; + } + + public String getCompressionType() { + return compressionType; + } + + public void setCompressionType(String compressionType) { + this.compressionType = compressionType; + } + + public void setArrayColumnCount(int arrayColumnCount) { + this.arrayColumnCount = arrayColumnCount; + } + + public int getArrayColumnCount() { + return arrayColumnCount; + } + + public void setStructColumnCount(int structColumnCount) { + this.structColumnCount = structColumnCount; + } + + public int getStructColumnCount() { + return structColumnCount; + } + + public void setMapColumnCount(int mapColumnCount) { + this.mapColumnCount = mapColumnCount; + } + + public int getMapColumnCount() { + return mapColumnCount; + } + + public Map<String, Object> getExtraSummary() { + return summary; + } + + public MetadataTableSummary addExtra(String key, SummaryMapBuilder builder) { + if (summary == null) { + summary = new HashMap<>(); + } + summary.put(key, builder.build()); + return this; + } + + public void addExtra(SummaryMapBuilder builder) { + if (summary == null) { + summary = new HashMap<>(); + } + summary.putAll(builder.build()); + } + + @Override + public String toString() { + return "TableSummary {" + "owner='" + owner + '\'' + ", db_name='" + dbName + '\'' + ", table_name='" + tblName + + '\'' + ", column_count=" + colCount + ", partition_count=" + partitionCount + ", table_type='" + tableType + '\'' + + ", file_format='" + fileFormat + '\'' + ", compression_type='" + compressionType + ", numRows=" + numRows + + ", numFiles=" + numFiles + ", size_bytes=" + totalSize + ", partition_column_count=" + partitionColumnCount + Review Comment: Should we add a boolean field `hasPartitions` and then add partitionCount and partitionColumnCount depending on this boolean count. -- 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