public List<Partition> getPartitions(Table tbl, Map<String, String> partialPartSpec,
       short limit) throws HiveException {
    PerfLogger perfLogger = SessionState.getPerfLogger();
    perfLogger.perfLogBegin(CLASS_NAME, PerfLogger.HIVE_GET_PARTITIONS_2);
    try {
      // TODO: Implement Batching when limit is >=0
      if (limit >= 0) {
        return getPartitionsWithAuth(tbl, partialPartSpec, limit);
      } else {
        int batchSize = MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.BATCH_RETRIEVE_MAX);
        return new ArrayList<>(getAllPartitionsInBatches(tbl, batchSize, DEFAULT_BATCH_DECAYING_FACTOR,
                MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.GETPARTITIONS_BATCH_MAX_RETRIES),
                partialPartSpec, true, getUserName(), getGroupNames()));
      }
    } finally {
      perfLogger.perfLogEnd(CLASS_NAME, PerfLogger.HIVE_GET_PARTITIONS_2, "HS2-cache");
    }
  }
Main method which fetches the partitions in batches
@param tbl table for which partitions are needed
@param batchSize Number of partitions to be fectehd in one batched call
@param decayingFactor the value by which batchSize decays in the next retry in case it faces an exception
@param maxRetries Number of retries allowed for this operation
@param partialPartitionSpec partialPartitionSpec for the table
@param isAuthRequired If auth information is required along with partitions
@param userName name of the calling user
@param groupNames groups the call
@return list of partition objects
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java