[ https://issues.apache.org/jira/browse/HIVE-1361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ning Zhang updated HIVE-1361: ----------------------------- Attachment: HIVE-1361.patch HIVE-1361.java_only.patch Uploading a full version (HIVE-1361.patch) and a Java code only version (HIVE-1361.java_only.patch). This patch is based on Ahmed's previous patch and implements the following feature: 1) automatically gather stats (number of rows currently) whenever an INSERT OVERWRITE TABLE is issued. Each mapper/reducer push their partial stats to either MySQL/Derby through JDBC or HBase. The INSERT OVERWRITE statement could be anything include dynamic partition insert, multi-table inserts and inserting to bucketized partitions. A StatsTask is responsible for aggregating partial stats at the end of the query and update the metastore. 2) The stats of a table/partition can be exposed to the user by 'DESC EXTENDED' to the table/partition. They are stored as the storage parameters (numRows, nuFiles, numPartitions). 3) Introducing a new command 'ANALYZE TABLE [PARTITION (PARTITION SPEC)] COMPUTE STATISTICS' to scan the table/partition and gather stats in a similar fashion as INSERT OVERWRITE command except that the plan has only 1 MR job consisting a TableScanOperator and a StatsTask. Partition spec could be full partition spec or partial partition spec similar to what dynamic partition insert uses. This allows the user to analyze a subset/all partitions of a table. The resulting stats are stored in the same parameter in the meatstore. Tested locally (unit tests) for JDBC:derby, hbase and on a cluster with JDBC:MySQL. Will run the full unit tests again. > table/partition level statistics > -------------------------------- > > Key: HIVE-1361 > URL: https://issues.apache.org/jira/browse/HIVE-1361 > Project: Hadoop Hive > Issue Type: Sub-task > Affects Versions: 0.6.0 > Reporter: Ning Zhang > Assignee: Ahmed M Aly > Attachments: HIVE-1361.java_only.patch, HIVE-1361.patch, stats0.patch > > > At the first step, we gather table-level stats for non-partitioned table and > partition-level stats for partitioned table. Future work could extend the > table level stats to partitioned table as well. > There are 3 major milestones in this subtask: > 1) extend the insert statement to gather table/partition level stats > on-the-fly. > 2) extend metastore API to support storing and retrieving stats for a > particular table/partition. > 3) add an ANALYZE TABLE [PARTITION] statement in Hive QL to gather stats for > existing tables/partitions. > The proposed stats are: > Partition-level stats: > - number of rows > - total size in bytes > - number of files > - max, min, average row sizes > - max, min, average file sizes > Table-level stats in addition to partition level stats: > - number of partitions -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.