code: def get_partition_order_mappings_by_block_table(
      block_table, block_row_size
  ):
      def _block_counter(kvs):
          partition_key = None
          size = 0
          first_block_id = ""
  
          for k, v in kvs:
              if size == 0 and len(v[0]):
                  partition_key = v[0][0]
  
              if first_block_id == "":
                  first_block_id = k
  
              size += len(v[0])
  
          if size == 0:
              partition_key = (
                  str(first_block_id) + "_" + str(uuid.uuid1())
              )
  
          return partition_key, size
  
      block_info = sorted(
          [
              summary[1]
              for summary in block_table.applyPartitions(
                  _block_counter
              ).collect()
          ]
      )
      block_order_mappings = dict()
      start_index = 0
      acc_block_num = 0
      for block_key, block_size in block_info:
          block_num = (
              block_size + block_row_size - 1
          ) // block_row_size
          block_order_mappings[block_key] = dict(
              start_index=start_index,
              end_index=start_index + block_size - 1,
              start_block_id=acc_block_num,
              end_block_id=acc_block_num + block_num - 1,
          )
          start_index += block_size
          acc_block_num += block_num
  
      return block_order_mappings
  
file_path: FATE/python/fate/arch/dataframe/ops/_indexer.py
imports: import functools
  import uuid
  from ..manager import Block, DataManager
  from .._dataframe import DataFrame
label_desc: Use image node_id 2 for calling a global function with example usage: get_partition_order_mappings_by_block_table(block_table, block_row_size) and returns: block_order_mappings, partition_key,  size