public synchronized List<Pair<TEndPoint, PipeTabletEventBatch>>
      getAllNonEmptyAndShouldEmitBatches() {
    final List<Pair<TEndPoint, PipeTabletEventBatch>> nonEmptyAndShouldEmitBatches =
        new ArrayList<>();
    if (!defaultBatch.isEmpty() && defaultBatch.shouldEmit()) {
      nonEmptyAndShouldEmitBatches.add(new Pair<>(null, defaultBatch));
    }
    endPointToBatch.forEach(
        (endPoint, batch) -> {
          if (!batch.isEmpty() && batch.shouldEmit()) {
            nonEmptyAndShouldEmitBatches.add(new Pair<>(endPoint, batch));
          }
        });
    return nonEmptyAndShouldEmitBatches;
  }
Get all batches that have at least 1 event.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/payload/evolvable/batch/PipeTransferBatchReqBuilder.java