public static boolean fromSameTable(Collection<Partition> partitions){
  if (partitions.size() == 0) {
    return false;
  }
  String dbName=null;
  String tableName=null;
  for (  Partition p : partitions) {
    if (dbName == null) {
      dbName=p.getDbName();
    }
 else     if (!dbName.equals(p.getDbName())) {
      return false;
    }
    if (tableName == null) {
      tableName=p.getTableName();
    }
 else     if (!tableName.equals(p.getTableName())) {
      return false;
    }
  }
  return true;
}

public static boolean fromSameTable ( Collection < Partition > partitions ) { if ( partitions . size ( ) == 0 ) { return false ; } String dbName = null ; String tableName = null ; for ( Partition p : partitions ) { if ( dbName == null ) { dbName = p . getDbName ( ) ; } else if ( ! dbName . equals ( p . getDbName ( ) ) ) { return false ; } if ( tableName == null ) { tableName = p . getTableName ( ) ; } else if ( ! tableName . equals ( p . getTableName ( ) ) ) { return false ; } } return true ; }
check to see that all of the partitions are from the same table .
