static boolean partitionInCustomLocation(Table table, Partition partition) throws HiveException {
    String subdir = null;
    try {
      subdir = Warehouse.makePartName(table.getPartCols(), partition.getValues());
    } catch (MetaException e) {
      throw new HiveException("Unable to get partition's directory", e);
    }

    Path tableDir = table.getDataLocation();
    if (tableDir == null) {
      throw new HiveException("Table has no location set");
    }

    String standardLocation = new Path(tableDir, subdir).toString();
    if (ArchiveUtils.isArchived(partition)) {
      return !getOriginalLocation(partition).equals(standardLocation);
    } else {
      return !partition.getLocation().equals(standardLocation);
    }
  }
Checks in partition is in custom (not-standard) location.
@param table - table in which partition is
@param partition - partition
@return true if partition location is custom, false if it is standard
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/archive/AlterTableArchiveUtils.java