python/ray/data/impl/lazy_block_list.py
def ensure_metadata_for_first_block(self) -> Optional[BlockMetadata]:
        """Ensure that the metadata is fetched and set for the first block.

        This will only block execution in order to fetch the post-read metadata for the
        first block if the pre-read metadata for the first block has no schema.

        Returns:
            None if the block list is empty, the metadata for the first block otherwise.
        """
        if not self._tasks:
            return None
        metadata = self._tasks[0].get_metadata()
        if metadata.schema is not None:
            # If pre-read schema is not null, we consider it to be "good enough" and use
            # it.
            return metadata
        # Otherwise, we trigger computation (if needed), wait until the task completes,
        # and fetch the block partition metadata.
        try:
            _, metadata_ref = next(self._iter_block_partition_refs())
        except (StopIteration, ValueError):
            # Dataset is empty (no blocks) or was manually cleared.
            pass
        else:
            # This blocks until the underlying read task is finished.
            metadata = ray.get(metadata_ref)
            self._cached_metadata[0] = metadata
        return metadata
Ensure that the metadata is fetched and set for the first block.

        This will only block execution in order to fetch the post-read metadata for the
        first block if the pre-read metadata for the first block has no schema.

        Returns:
            None if the block list is empty, the metadata for the first block otherwise.
        
Ensure that the metadata is fetched and set for the first block.
This will only block execution in order to fetch the post-read metadata for the
first block if the pre-read metadata for the first block has no schema.
Ensure that the metadata is fetched and set for the first block . This will only block execution in order to fetch the post - read metadata for the first block if the pre - read metadata for the first block has no schema .
def ensure_metadata_for_first_block(self) -> Optional[BlockMetadata]:
        if not self._tasks:
            return None
        metadata = self._tasks[0].get_metadata()
        if metadata.schema is not None:
            return metadata
        try:
            _, metadata_ref = next(self._iter_block_partition_refs())
        except (StopIteration, ValueError):
            pass
        else:
            metadata = ray.get(metadata_ref)
            self._cached_metadata[0] = metadata
        return metadata
def ensure_metadata_for_first_block ( self ) -> Optional [ BlockMetadata ] : if not self . _tasks : return None metadata = self . _tasks [ 0 ] . get_metadata ( ) if metadata . schema is not None : return metadata try : _ , metadata_ref = next ( self . _iter_block_partition_refs ( ) ) except ( StopIteration , ValueError ) : pass else : metadata = ray . get ( metadata_ref ) self . _cached_metadata [ 0 ] = metadata return metadata
Ensure that the metadata is fetched and set for the first block.
Ensure that the metadata is fetched and set for the first block .
"""Ensure that the metadata is fetched and set for the first block.

        This will only block execution in order to fetch the post-read metadata for the
        first block if the pre-read metadata for the first block has no schema.

        Returns:
            None if the block list is empty, the metadata for the first block otherwise.
        """ # If pre-read schema is not null, we consider it to be "good enough" and use # it. # Otherwise, we trigger computation (if needed), wait until the task completes, # and fetch the block partition metadata. # Dataset is empty (no blocks) or was manually cleared. # This blocks until the underlying read task is finished.
None if the block list is empty, the metadata for the first block otherwise.
None if the block list is empty the metadata for the first block otherwise .
self