DanielZhu58 commented on code in PR #6438:
URL: https://github.com/apache/hive/pull/6438#discussion_r3193955499


##########
standalone-metastore/metastore-tools/metastore-benchmarks/src/main/java/org/apache/hadoop/hive/metastore/tools/HMSBenchmarks.java:
##########
@@ -695,4 +697,64 @@ static DescriptiveStatistics 
benchmarkPartitionManagement(@NotNull MicroBenchmar
     }
   }
 
+  static DescriptiveStatistics benchmarkStatisticsManagement(@NotNull 
MicroBenchmark bench,
+                                                             @NotNull 
BenchData data,
+                                                             int tableCount) {
+
+    String dbName = data.dbName + "_" + tableCount;
+    String tableNamePrefix = data.tableName;
+    final HMSClient client = data.getClient();
+    final StatisticsManagementTask statsTask = new StatisticsManagementTask();
+    try {
+      client.getHadoopConf().set("hive.metastore.uris", 
client.getServerURI().toString());
+      
client.getHadoopConf().set("metastore.statistics.management.database.pattern", 
dbName);
+      statsTask.setConf(client.getHadoopConf());
+
+      client.createDatabase(dbName);
+      for (int i = 0; i < tableCount; i++) {
+        String tableName = tableNamePrefix + "_" + i;
+        Util.TableBuilder tableBuilder = new Util.TableBuilder(dbName, 
tableName)
+                .withType(TableType.MANAGED_TABLE)
+                .withColumns(createSchema(Arrays.asList("col1:string", 
"col2:int")))
+                
.withPartitionKeys(createSchema(Collections.singletonList("part_col")))
+                .withParameter("columnStatsAccurate", "true");
+

Review Comment:
   Acknowledged.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to