@Override
  public NotificationEventResponse getNextNotification(NotificationEventRequest rqst) {
    boolean commited = false;
    Query query = null;

    NotificationEventResponse result = new NotificationEventResponse();
    result.setEvents(new ArrayList<>());
    try {
      openTransaction();
      long lastEvent = rqst.getLastEvent();
      List<Object> parameterVals = new ArrayList<>();
      parameterVals.add(lastEvent);
      // filterBuilder parameter is used for construction of conditional clause in the select query
      StringBuilder filterBuilder = new StringBuilder("eventId > para" + parameterVals.size());
      // parameterBuilder parameter is used for specify what types of parameters will go into the filterBuilder
      StringBuilder parameterBuilder = new StringBuilder("java.lang.Long para" + parameterVals.size());
      /* A fully constructed query would like:
      ->  filterBuilder: eventId > para0 && catalogName == para1 && dbName == para2 && (tableName == para3
          || tableName == para4) && eventType != para5
      ->  parameterBuilder: java.lang.Long para0, java.lang.String para1, java.lang.String para2
          , java.lang.String para3, java.lang.String para4, java.lang.String para5
       */
      if (rqst.isSetCatName()) {
        parameterVals.add(normalizeIdentifier(rqst.getCatName()));
        parameterBuilder.append(", java.lang.String para" + parameterVals.size());
        filterBuilder.append(" && catalogName == para" + parameterVals.size());
      }
      if (rqst.isSetDbName()) {
        parameterVals.add(normalizeIdentifier(rqst.getDbName()));
        parameterBuilder.append(", java.lang.String para" + parameterVals.size());
        filterBuilder.append(" && dbName == para" + parameterVals.size());
      }
      if (rqst.isSetTableNames() && !rqst.getTableNames().isEmpty()) {
        filterBuilder.append(" && (");
        for (String tableName : rqst.getTableNames()) {
          parameterVals.add(normalizeIdentifier(tableName));
          parameterBuilder.append(", java.lang.String para" + parameterVals.size());
          filterBuilder.append("tableName == para" + parameterVals.size()+ " || ");
        }
        filterBuilder.setLength(filterBuilder.length() - 4); // remove the last " || "
        filterBuilder.append(") ");
      }
      if (rqst.isSetEventTypeList()) {
        filterBuilder.append(" && (");
        for (String eventType : rqst.getEventTypeList()) {
          parameterVals.add(eventType);
          parameterBuilder.append(", java.lang.String para" + parameterVals.size());
          filterBuilder.append("eventType == para" + parameterVals.size() + " || ");
        }
        filterBuilder.setLength(filterBuilder.length() - 4); // remove the last " || "
        filterBuilder.append(") ");
      }
      if (rqst.isSetEventTypeSkipList()) {
        for (String eventType : rqst.getEventTypeSkipList()) {
          parameterVals.add(eventType);
          parameterBuilder.append(", java.lang.String para" + parameterVals.size());
          filterBuilder.append(" && eventType != para" + parameterVals.size());
        }
      }
      query = pm.newQuery(MNotificationLog.class, filterBuilder.toString());
      query.declareParameters(parameterBuilder.toString());
      query.setOrdering("eventId ascending");
      int maxEventResponse = MetastoreConf.getIntVar(conf, ConfVars.METASTORE_MAX_EVENT_RESPONSE);
      int maxEvents = (rqst.getMaxEvents() < maxEventResponse && rqst.getMaxEvents() > 0) ? rqst.getMaxEvents() : maxEventResponse;
      query.setRange(0, maxEvents);
      Collection<MNotificationLog> events =
              (Collection) query.executeWithArray(parameterVals.toArray(new Object[0]));
      commited = commitTransaction();
      if (events == null) {
        return result;
      }
      Iterator<MNotificationLog> i = events.iterator();
      while (i.hasNext()) {
        result.addToEvents(translateDbToThrift(i.next()));
      }
      return result;
    } 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