
    &`i                         d dl mZmZmZmZ d dlmZmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ erd dlZ G d d	e          ZdS )
    )TYPE_CHECKINGIteratorListUnion)BlockOutputBufferOutputBlockSizeOption)_check_import)Block)DataContext)FileBasedDatasourceNc                   j     e Zd ZdZdgZdeeee         f         f fdZdddede	e
         fd	Z xZS )
AvroDatasourcez#A datasource that reads Avro files.avropathsc                 `     t                      j        |fi | t          | dd           d S )Nfastavro)modulepackage)super__init__r	   )selfr   file_based_datasource_kwargs	__class__s      /home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/data/_internal/datasource/avro_datasource.pyr   zAvroDatasource.__init__   s@    
 	??">???d:zBBBBBB    fzpyarrow.NativeFilepathreturnc              #     K   dd l }|                    |          }t          j                    }t	          j        |j                  }t          |          }|D ]U}|                    |           |	                                r*|
                                V  |	                                *V|                                 |	                                r,|
                                V  |	                                *d S d S )Nr   )target_max_block_size)r   readerr   get_currentr   ofr    r   addhas_nextnextfinalize)	r   r   r   r   r!   ctxoutput_block_size_optionoutput_bufferrecords	            r   _read_streamzAvroDatasource._read_stream   s.      ##%''#8#;"%";$
 $
 $
  **BCC 	+ 	+Ff%%%((** +#((*****  ((** + 	   $$&& 	'$$&&&&& $$&& 	' 	' 	' 	' 	'r   )__name__
__module____qualname____doc___FILE_EXTENSIONSr   strr   r   r   r
   r,   __classcell__)r   s   @r   r   r      s        --xCS$s)^$C C C C C C'2 '# '(5/ ' ' ' ' ' ' ' 'r   r   )typingr   r   r   r    ray.data._internal.output_bufferr   r   ray.data._internal.utilr	   ray.data.blockr
   ray.data.contextr   )ray.data.datasource.file_based_datasourcer   pyarrowr    r   r   <module>r<      s    7 7 7 7 7 7 7 7 7 7 7 7 U U U U U U U U 1 1 1 1 1 1             ( ( ( ( ( ( I I I I I I NNN '  '  '  '  '(  '  '  '  '  'r   