public List<String> getPartitionNames(Table tbl, ExprNodeGenericFuncDesc expr, String order,
       short maxParts) throws HiveException {
    List<String> names = null;
    // the exprBytes should not be null by thrift definition
    byte[] exprBytes = {(byte)-1};
    if (expr != null) {
      exprBytes = SerializationUtilities.serializeObjectWithTypeInformation(expr);
    }
    try {
      String defaultPartitionName = HiveConf.getVar(conf, ConfVars.DEFAULT_PARTITION_NAME);
      PartitionsByExprRequest req =
          new PartitionsByExprRequest(tbl.getDbName(), tbl.getTableName(), ByteBuffer.wrap(exprBytes));
      if (defaultPartitionName != null) {
        req.setDefaultPartitionName(defaultPartitionName);
      }
      if (maxParts >= 0) {
        req.setMaxParts(maxParts);
      }
      req.setOrder(order);
      req.setCatName(tbl.getCatalogName());
      if (AcidUtils.isTransactionalTable(tbl)) {
        ValidWriteIdList validWriteIdList = getValidWriteIdList(tbl.getDbName(), tbl.getTableName());
        req.setValidWriteIdList(validWriteIdList != null ? validWriteIdList.toString() : null);
        req.setId(tbl.getTTable().getId());
      }
      names = getMSC().listPartitionNames(req);

    } catch (NoSuchObjectException nsoe) {
      return Lists.newArrayList();
    } catch (Exception e) {
      LOG.error("Failed getPartitionNames", e);
      throw new HiveException(e);
    }
    return names;
  }
This method helps callers trigger an INSERT event for DML queries without having to deal with
HMS objects. This takes java object types as arguments.
@param dbName Name of the hive database this table belongs to.
@param tblName Name of the hive table this event is for.
@param partitionSpec Map containing key/values for each partition column. Can be null if the event is for a table
@param replace boolean to indicate whether the filelist is replacement of existing files. Treated as additions otherwise
@param newFiles List of file paths affected (added/replaced) by this DML query. Can be null
@throws HiveException if the table or partition does not exist or other internal errors in fetching them
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java