private void createPartitionedTable(boolean withPrivileges, boolean withStatistics)
      throws Exception {
    Database db1 = new DatabaseBuilder()
                       .setName(DB1)
                       .setDescription("description")
                       .setLocation("locationurl")
                       .build(conf);
    try (AutoCloseable c = deadline()) {
      objectStore.createDatabase(db1);
    }
    Table tbl1 =
        new TableBuilder()
            .setDbName(DB1)
            .setTableName(TABLE1)
            .addCol("test_col1", "int")
            .addCol("test_col2", "int")
            .addPartCol("test_part_col", "int")
            .addCol("test_bucket_col", "int", "test bucket col comment")
            .addCol("test_skewed_col", "int", "test skewed col comment")
            .addCol("test_sort_col", "int", "test sort col comment")
            .build(conf);
    try (AutoCloseable c = deadline()) {
      objectStore.createTable(tbl1);
    }
    MTable mTable1 = objectStore.ensureGetMTable(tbl1.getCatName(), tbl1.getDbName(), tbl1.getTableName());
    PrivilegeBag privilegeBag = new PrivilegeBag();
    // Create partitions for the partitioned table
    for(int i=0; i < 3; i++) {
      Partition part = new PartitionBuilder()
                           .inTable(tbl1)
                           .addValue("a" + i)
                           .addSerdeParam("serdeParam", "serdeParamValue")
                           .addStorageDescriptorParam("sdParam", "sdParamValue")
                           .addBucketCol("test_bucket_col")
                           .addSkewedColName("test_skewed_col")
                           .addSortCol("test_sort_col", 1)
                           .build(conf);
      try (AutoCloseable c = deadline()) {
        objectStore.addPartition(part);
      }
      if (withPrivileges) {
        HiveObjectRef partitionReference = new HiveObjectRefBuilder().buildPartitionReference(part);
        HiveObjectRef partitionColumnReference = new HiveObjectRefBuilder()
            .buildPartitionColumnReference(tbl1, "test_part_col", part.getValues());
        PrivilegeGrantInfo privilegeGrantInfo = new PrivilegeGrantInfoBuilder()
            .setPrivilege("a")
            .build();
        HiveObjectPrivilege partitionPriv = new HiveObjectPrivilegeBuilder()
                                                .setHiveObjectRef(partitionReference)
                                                .setPrincipleName("a")
                                                .setPrincipalType(PrincipalType.USER)
                                                .setGrantInfo(privilegeGrantInfo)
                                                .build();
        privilegeBag.addToPrivileges(partitionPriv);
        HiveObjectPrivilege partitionColPriv = new HiveObjectPrivilegeBuilder()
                                                   .setHiveObjectRef(partitionColumnReference)
                                                   .setPrincipleName("a")
                                                   .setPrincipalType(PrincipalType.USER)
                                                   .setGrantInfo(privilegeGrantInfo)
                                                   .build();
        privilegeBag.addToPrivileges(partitionColPriv);
      }

      if (withStatistics) {
        ColumnStatistics stats = new ColumnStatistics();
        ColumnStatisticsDesc desc = new ColumnStatisticsDesc();
        desc.setCatName(tbl1.getCatName());
        desc.setDbName(tbl1.getDbName());
        desc.setTableName(tbl1.getTableName());
        desc.setPartName("test_part_col=a" + i);
        stats.setStatsDesc(desc);

        List<ColumnStatisticsObj> statsObjList = new ArrayList<>(1);
        stats.setStatsObj(statsObjList);
        stats.setEngine(ENGINE);

        ColumnStatisticsData data = new ColStatsBuilder<>(long.class).numNulls(1).numDVs(2)
            .low(3L).high(4L).hll(3, 4).kll(3, 4).build();

        ColumnStatisticsObj partStats = new ColumnStatisticsObj("test_part_col", "int", data);
        statsObjList.add(partStats);

        try (AutoCloseable c = deadline()) {
          objectStore.updatePartitionColumnStatistics(tbl1, mTable1, stats, part.getValues(), null, -1);
        }
      }
    }
    if (withPrivileges) {
      try (AutoCloseable c = deadline()) {
        objectStore.grantPrivileges(privilegeBag);
      }
    }
  }
Creates DB1 database, TABLE1 table with 3 partitions.
@param withPrivileges Should we create privileges as well
@param withStatistics Should we create statitics as well
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java