private void addPartitionsInternal(String catName, String dbName,
                                     String tblName, List<Partition> parts)
      throws MetaException, InvalidObjectException {
    List<MTablePrivilege> tabGrants = null;
    List<MTableColumnPrivilege> tabColumnGrants = null;
    MTable table = this.getMTable(catName, dbName, tblName);
    if (table == null) {
      throw new InvalidObjectException("Unable to add partitions because "
          + TableName.getQualified(catName, dbName, tblName) +
          " does not exist");
    }
    if ("TRUE".equalsIgnoreCase(table.getParameters().get("PARTITION_LEVEL_PRIVILEGE"))) {
      tabGrants = this.listAllTableGrants(catName, dbName, tblName);
      tabColumnGrants = this.listTableAllColumnGrants(catName, dbName, tblName);
    }
    List<MPartition> mParts = new ArrayList<>();
    List<List<MPartitionPrivilege>> mPartPrivilegesList = new ArrayList<>();
    List<List<MPartitionColumnPrivilege>> mPartColPrivilegesList = new ArrayList<>();
    for (Partition part : parts) {
      if (!part.getTableName().equals(tblName) || !part.getDbName().equals(dbName)) {
        throw new MetaException("Partition does not belong to target table "
            + dbName + "." + tblName + ": " + part);
      }
      MPartition mpart = convertToMPart(part, table);
      mParts.add(mpart);
      int now = (int) (System.currentTimeMillis() / 1000);
      List<MPartitionPrivilege> mPartPrivileges = new ArrayList<>();
      if (tabGrants != null) {
        for (MTablePrivilege tab: tabGrants) {
          MPartitionPrivilege mPartPrivilege = new MPartitionPrivilege(tab.getPrincipalName(), tab.getPrincipalType(),
              mpart, tab.getPrivilege(), now, tab.getGrantor(), tab.getGrantorType(), tab.getGrantOption(),
              tab.getAuthorizer());
          mPartPrivileges.add(mPartPrivilege);
        }
      }

      List<MPartitionColumnPrivilege> mPartColumnPrivileges = new ArrayList<>();
      if (tabColumnGrants != null) {
        for (MTableColumnPrivilege col : tabColumnGrants) {
          MPartitionColumnPrivilege mPartColumnPrivilege = new MPartitionColumnPrivilege(col.getPrincipalName(),
              col.getPrincipalType(), mpart, col.getColumnName(), col.getPrivilege(), now, col.getGrantor(),
              col.getGrantorType(), col.getGrantOption(), col.getAuthorizer());
          mPartColumnPrivileges.add(mPartColumnPrivilege);
        }
      }
      mPartPrivilegesList.add(mPartPrivileges);
      mPartColPrivilegesList.add(mPartColumnPrivileges);
    }
    if (CollectionUtils.isNotEmpty(mParts)) {
      GetHelper<Void> helper = new GetHelper<Void>(null, null, null, true, true) {
        @Override
        protected Void getSqlResult(GetHelper<Void> ctx) throws MetaException {
          directSql.addPartitions(mParts, mPartPrivilegesList, mPartColPrivilegesList);
          return null;
        }

        @Override
        protected Void getJdoResult(GetHelper<Void> ctx) {
          List<Object> toPersist = new ArrayList<>(mParts);
          mPartPrivilegesList.forEach(toPersist::addAll);
          mPartColPrivilegesList.forEach(toPersist::addAll);
          pm.makePersistentAll(toPersist);
          pm.flush();
          return null;
        }

        @Override
        protected String describeResult() {
          return "add partitions";
        }
      };
      try {
        helper.run(false);
      } catch (NoSuchObjectException e) {
        throw newMetaException(e);
      }
    }
  }
This method resets the stats to 0 and supports only backward compatibility with clients does not
send {@link SourceTable} instances.

Use {@link ObjectStore#convertToSourceTable(String, SourceTable)} instead.

@param catalog Catalog name where source table is located
@param fullyQualifiedTableName fully qualified name of source table
@return {@link MMVSource} instance represents this source table.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java