void checkTable(String catName, String dbName, String tableName, byte[] filterExp, Table table, CheckResult result)
      throws MetaException, IOException, MetastoreException {

    if (table == null) {
      try {
        table = getMsc().getTable(catName, dbName, tableName);
      } catch (TException e) {
        result.getTablesNotInMs().add(tableName);
        return;
      }
    }

    PartitionIterable parts;

    if (isPartitioned(table)) {
      if (filterExp != null) {
        List<Partition> results = new ArrayList<>();
        getPartitionListByFilterExp(getMsc(), table, filterExp,
            MetastoreConf.getVar(conf, MetastoreConf.ConfVars.DEFAULTPARTITIONNAME), results);
        parts = new PartitionIterable(results);
      } else {
        GetProjectionsSpec projectionsSpec = new GetPartitionProjectionsSpecBuilder()
                .addProjectFieldList(Arrays.asList("sd.location","createTime","values")).build();
        GetPartitionsRequest request = new GetPartitionsRequest(table.getDbName(), table.getTableName(),
                projectionsSpec, null);
        request.setCatName(table.getCatName());
        int batchSize = MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.BATCH_RETRIEVE_MAX);
        if (batchSize > 0) {
          parts = new PartitionIterable(getMsc(), table, batchSize).withProjectSpec(request);
        } else {
          parts = new PartitionIterable(getPartitionsByProjectSpec(msc, request));
        }
      }
    } else {
      parts = new PartitionIterable(Collections.emptyList());
    }

    checkTable(table, parts, filterExp, result);
  }
Check the metastore for inconsistencies, data missing in either the
metastore or on the dfs.

@param catName
         name of the catalog, if not specified default catalog will be used.
@param dbName
         Name of the database
@param tableName
         Name of the table
@param filterExp
         Filter expression which is used to prune th partition from the
         metastore and FileSystem.
@param table Table we want to run the check for.
@param result
         Result object
@throws MetastoreException
          Failed to get required information from the metastore.
@throws IOException
          Most likely filesystem related
@throws MetaException
          Failed to get required information from the metastore.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreChecker.java