@Override
  public NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCountRequest rqst) {
    Long result = 0L;
    boolean commited = false;
    Query query = null;
    try {
      openTransaction();
      long fromEventId = rqst.getFromEventId();
      String inputDbName = rqst.getDbName();
      String catName = rqst.isSetCatName() ? rqst.getCatName() : getDefaultCatalog(conf);
      long toEventId;
      String paramSpecs;
      List<Object> paramVals = new ArrayList<>();

      // We store a catalog name in lower case in metastore and also use the same way everywhere in
      // hive.
      assert catName.equals(catName.toLowerCase());

      // Build the query to count events, part by part
      String queryStr = "select count(eventId) from " + MNotificationLog.class.getName();
      // count fromEventId onwards events
      queryStr = queryStr + " where eventId > fromEventId";
      paramSpecs = "java.lang.Long fromEventId";
      paramVals.add(Long.valueOf(fromEventId));

      // Input database name can be a database name or a *. In the first case we add a filter
      // condition on dbName column, but not in the second case, since a * means all the
      // databases. In case we support more elaborate database name patterns in future, we will
      // have to apply a method similar to getNextNotification() method of MetaStoreClient.
      if (!inputDbName.equals("*")) {
        // dbName could be NULL in case of transaction related events, which also need to be
        // counted.
        queryStr = queryStr + " && (dbName == inputDbName || dbName == null)";
        paramSpecs = paramSpecs + ", java.lang.String inputDbName";
        // We store a database name in lower case in metastore.
        paramVals.add(inputDbName.toLowerCase());
      }

      // catName could be NULL in case of transaction related events, which also need to be
      // counted.
      queryStr = queryStr + " && (catalogName == catName || catalogName == null)";
      paramSpecs = paramSpecs +", java.lang.String catName";
      paramVals.add(catName);

      // count events upto toEventId if specified
      if (rqst.isSetToEventId()) {
        toEventId = rqst.getToEventId();
        queryStr = queryStr + " && eventId <= toEventId";
        paramSpecs = paramSpecs + ", java.lang.Long toEventId";
        paramVals.add(Long.valueOf(toEventId));
      }
      // Specify list of table names in the query string and parameter types
      if (rqst.isSetTableNames() && !rqst.getTableNames().isEmpty()) {
        queryStr = queryStr + " && (";
        for (String tableName : rqst.getTableNames()) {
          paramVals.add(tableName.toLowerCase());
          queryStr = queryStr + "tableName == tableName" + paramVals.size() + " || ";
          paramSpecs = paramSpecs + ", java.lang.String tableName" + paramVals.size();
        }
        queryStr = queryStr.substring(0, queryStr.length() - 4); // remove the last " || "
        queryStr += ")";
      }

      query = pm.newQuery(queryStr);
      query.declareParameters(paramSpecs);
      result = (Long) query.executeWithArray(paramVals.toArray());
      commited = commitTransaction();

      // Cap the event count by limit if specified.
      long  eventCount = result.longValue();
      if (rqst.isSetLimit() && eventCount > rqst.getLimit()) {
        eventCount = rqst.getLimit();
      }

      return new NotificationEventsCountResponse(eventCount);
    } finally {
      rollbackAndCleanup(commited, query);
    }
  }
Get partition's column stats

@return Map of column name and its stats
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java