code: private boolean receivedLastMessageForPartition(PartitionReplyMsg msg, List<Integer> finishedPartitions) {
  
          switch (msg.getMsgType()) {
  
              case PARTITION_FINAL_STATUS:
                  if (msg.getPartitionPlanConfig() != null) {
                      partitionFinished(msg);
                      finishedPartitions.add(msg.getPartitionPlanConfig().getPartitionNumber());
                      return true;
                  } else {
                      return false;
                  }
              case PARTITION_THREAD_COMPLETE:
                  partitionFinished(msg);
                  finishedPartitions.add(msg.getPartitionPlanConfig().getPartitionNumber());
                  return true;
              default:
                  return false;
          }
      }
docs: /*
  Check if its the last message received for this partition
  
  We are still checking for THREAD_COMPLETE to maintain compatibility with 8.5.5.7,
  which sends FINAL_STATUS without a partitionNumber ,and THREAD_COMPLETE with a partitionNumber,
  although, now the executor does not send a THREAD_COMPLETE message, just a FINAL_STATUS message with a partitionNumber
  
  @returns true if no more messages for the partition is expected to be received
  
  @returns false if more messages are to be received for the partition