Gets the lengths of the blocks.

        Note: This works with the property structure `_lengths_cache` to avoid
            having to recompute these values each time they are needed.

def block_lengths(self):
        """Gets the lengths of the blocks.

        Note: This works with the property structure `_lengths_cache` to avoid
            having to recompute these values each time they are needed.
        """
        if self._lengths_cache is None:
            try:
                # The first column will have the correct lengths. We have an
                # invariant that requires that all blocks be the same length in a
                # row of blocks.
                self._lengths_cache = np.array(
                    ray.get([obj.length().oid for obj in self._partitions_cache.T[0]])
                    if len(self._partitions_cache.T) > 0
                    else []
                )
            except RayTaskError as e:
                handle_ray_task_error(e)
        return self._lengths_cache