Ë
    ëmxi=  ã                   ó  — d dl mZmZmZ d dlmZmZ 	 d dlmZm	Z	m
Z
mZmZmZmZmZmZ 	 d dlmZ d dlmZ dd„Zddd
dedfd„Zd
efd„Zd„ Zefd„Zdd„Zy# e$ rZ ed ee«      › d�«      d‚dZ[ww xY w# e$ r  G d„ d	«      ZeZY ŒTw xY w)é    )ÚTableÚRecordBatchÚarray)Ú
ExpressionÚfield)	ÚDeclarationÚExecNodeOptionsÚTableSourceNodeOptionsÚFilterNodeOptionsÚProjectNodeOptionsÚAggregateNodeOptionsÚOrderByNodeOptionsÚHashJoinNodeOptionsÚAsofJoinNodeOptionsz@The pyarrow installation is not built with support for 'acero' (ú)N)ÚScanNodeOptionsc                   ó4   — e Zd Z G d„ d«      Z G d„ d«      Zy)ÚDatasetModuleStubc                   ó   — e Zd Zy)úDatasetModuleStub.DatasetN©Ú__name__Ú
__module__Ú__qualname__© ó    úD/home/htdocs/ttos/venv/lib/python3.12/site-packages/pyarrow/acero.pyÚDatasetr   3   ó   „ Ør   r   c                   ó   — e Zd Zy)ú!DatasetModuleStub.InMemoryDatasetNr   r   r   r   ÚInMemoryDatasetr!   6   r   r   r"   N)r   r   r   r   r"   r   r   r   r   r   2   s   „ ÷	ñ 	÷	ò 	r   r   TFc           	      óz  — t        dt        | ||¬«      «      }| j                  j                  D �cg c]  }t	        |«      ‘Œ }}t        j
                  |t        dt        |«      «      g«      }| j                  j                  d«      }|�*t        j
                  |t        dt        |«      «      g«      }|S c c}w )NÚscan©Úuse_threadsÚimplicit_orderingÚprojectÚfilter)
r   r   ÚschemaÚnamesr   Úfrom_sequencer   Ú_scan_optionsÚgetr   )Údatasetr&   r'   ÚdeclÚfÚprojectionsÚfilter_exprs          r   Ú_dataset_to_declr4   ;   s¶   € Ü�vœØ˜[Ø+ô -ó .€Dð &-§^¡^×%9Ñ%9Ö: ”5˜•8Ð:€KÐ:Ü×$Ñ$Ø	Œ{˜9Ô&8¸Ó&EÓFÐGó€Dð ×'Ñ'×+Ñ+¨HÓ5€KØÐô ×(Ñ(Ø”;˜xÔ):¸;Ó)GÓHÐIó
ˆð €Kùò ;s   ±B8c                 óö  — t        |t        t        j                  f«      st	        dt        |«      › �«      ‚t        |t        t        j                  f«      st	        dt        |«      › �«      ‚i }t        |t        t        f«      s|g}t        |«      D ]
  \  }}|||<   Œ i }t        |t        t        f«      s|g}t        |«      D ]
  \  }}|||<   Œ |j                  j                  }|j                  j                  }| dk(  s| dk(  rg }nE| dk(  s| dk(  rg }n8| dk(  s| dk(  r|D �cg c]	  }||vsŒ|‘Œ }}n| dk(  r|D �cg c]	  }||vsŒ|‘Œ }}i }t        |«      D ]  \  }}||v sŒ|||<   Œ i }t        |«      D ]  \  }}||v sŒ|||<   Œ t        |t        j                  «      rt        ||¬	«      }nt        d
t        |«      «      }t        |t        j                  «      rt        ||¬	«      }nt        d
t        |«      «      }|rt        | |||||xs d|xs d|
¬«      }nt        | |||xs d|xs d|
¬«      }t        d|||g¬«      }|�rL| dk(  �rFt        |«      }t        |«      }t!        |«      }g }g }t        ||z   «      D ]ã  \  }}|t!        |«      k  rq||v rm|j#                  |«       ||||         }|j#                  t%        j&                  dt%        j(                  |«      t%        j(                  ||z   «      g«      «       Œ…||k\  r||v rŒ�|r||k  r	||v r||z  }|r||k\  r	||v r||z  }|j#                  |«       |j#                  t%        j(                  |«      «       Œå t        dt+        ||«      «      }t        j,                  ||g«      }|j/                  |¬	«      } |	t        k(  r| S |	t        j0                  k(  rt        j0                  | «      S t	        d«      ‚c c}w c c}w )aÉ  
    Perform join of two tables or datasets.

    The result will be an output table with the result of the join operation

    Parameters
    ----------
    join_type : str
        One of supported join types.
    left_operand : Table or Dataset
        The left operand for the join operation.
    left_keys : str or list[str]
        The left key (or keys) on which the join operation should be performed.
    right_operand : Table or Dataset
        The right operand for the join operation.
    right_keys : str or list[str]
        The right key (or keys) on which the join operation should be performed.
    left_suffix : str, default None
        Which suffix to add to left column names. This prevents confusion
        when the columns in left and right operands have colliding names.
    right_suffix : str, default None
        Which suffix to add to the right column names. This prevents confusion
        when the columns in left and right operands have colliding names.
    use_threads : bool, default True
        Whether to use multithreading or not.
    coalesce_keys : bool, default False
        If the duplicated keys should be omitted from one of the sides
        in the join result.
    output_type: Table or InMemoryDataset
        The output type for the exec plan result.
    filter_expression : pyarrow.compute.Expression
        Residual filter which is applied to matching row.

    Returns
    -------
    result_table : Table or InMemoryDataset
    úExpected Table or Dataset, got z	left semiz	left antiz
right semiz
right antiÚinnerz
left outerzright outer©r&   Útable_sourceÚ )Úoutput_suffix_for_leftÚoutput_suffix_for_rightÚfilter_expressionÚhashjoin©ÚoptionsÚinputsz
full outerÚcoalescer(   úUnsupported output type)Ú
isinstancer   Údsr   Ú	TypeErrorÚtypeÚtupleÚlistÚ	enumerater*   r+   r4   r   r
   r   ÚsetÚlenÚappendr   Ú_callÚ_fieldr   r,   Úto_tabler"   )!Ú	join_typeÚleft_operandÚ	left_keysÚright_operandÚ
right_keysÚleft_suffixÚright_suffixr&   Úcoalesce_keysÚoutput_typer=   Úleft_keys_orderÚidxÚkeyÚright_keys_orderÚleft_columnsÚright_columnsÚcolÚleft_column_keys_indicesÚcolnameÚright_column_keys_indicesÚleft_sourceÚright_sourceÚ	join_optsr0   Úleft_columns_setÚright_columns_setÚright_operand_indexÚprojected_col_namesr2   Úright_key_indexÚ
projectionÚresult_tables!                                    r   Ú_perform_joinrn   R   s’  € ôT �l¤U¬B¯J©JÐ$7Ô8ÜÐ9¼$¸|Ó:LÐ9MÐNÓOÐOÜ�m¤e¬R¯Z©ZÐ%8Ô9ÜÐ9¼$¸}Ó:MÐ9NÐOÓPÐPð €OÜ�i¤%¬ Ô/Ø�Kˆ	Ü˜iÓ(ò #‰ˆˆSØ"ˆ˜Òð#ð ÐÜ�j¤4¬ -Ô0Ø �\ˆ
Ü˜jÓ)ò $‰ˆˆSØ #Ð˜Òð$ð  ×&Ñ&×,Ñ,€LØ!×(Ñ(×.Ñ.€Mð �KÒ 9°Ò#;Ø‰Ø	�lÒ	" i°<Ò&?Ø‰Ø	�gÒ	 ¨lÒ!:à(ö
Ø¨CÐ7GÒ,GŠCð
ˆñ 
ð 
�mÒ	#à'ö
Ø¨3°oÒ+EŠCð
ˆð 
ð  "ÐÜ! ,Ó/ò 4‰ˆˆWØ�iÒØ03Ð$ WÒ-ð4ð !#ÐÜ! -Ó0ò 5‰ˆˆWØ�jÒ Ø14Ð% gÒ.ð5ô
 �,¤§
¡
Ô+Ü& |ÀÔM‰ä! .Ô2HÈÓ2VÓWˆÜ�-¤§¡Ô,Ü'¨À;ÔO‰ä"ØÔ2°=ÓAó
ˆñ Ü'Ø�y *¨l¸MØ#.Ò#4°"Ø$0Ò$6°BØ/ô	
‰	ô (Ø�y *Ø#.Ò#4°"Ø$0Ò$6°BØ/ô	
ˆ	ô Ø˜I¨{¸LÐ.Iô€Dò ˜ lÓ2ô ˜|Ó,ÐÜ Ó.Ðä! ,Ó/ÐØ ÐØˆÜ! ,°Ñ">Ó?ò $	‰HˆC�Ø”S˜Ó&Ò&¨3Ð2JÑ+Jà#×*Ñ*¨3Ô/ð
 #<Ø˜¨sÑ3Ñ4ñ#6�à×"Ñ"Ü×$Ñ$ ZÜ"×)Ñ)¨#Ó.´
×0AÑ0AØ/°Ñ?ó1Að2ó õð Ð+Ò+°Ð7PÑ0Pàñ   CÐ*=Ò$=ØÐ0Ñ0à˜;Ñ&�Cá  SÐ,?Ò%?ØÐ/Ñ/à˜<Ñ'�CØ#×*Ñ*¨3Ô/Ø×"Ñ"Ü×%Ñ% cÓ*õðE$	ôJ !ØÔ)¨+Ð7JÓKó
ˆ
ô ×(Ñ(¨$°
Ð);Ó<ˆà—=‘=¨[�=Ó9€Là”eÒØÐØ	œ×*Ñ*Ò	*Ü×!Ñ! ,Ó/Ð/äÐ1Ó2Ð2ùòY
ùò
s   Ä)	O1Ä3O1Å	O6ÅO6c	                 óð  — t        | t        t        j                  f«      st	        dt        | «      › �«      ‚t        |t        t        j                  f«      st	        dt        |«      › �«      ‚t        |t        t        f«      s|g}t        |t        t        f«      s|g}|j                  j                  D �	cg c]  }	|	|g|z   vr|	‘Œ }
}	t        | j                  j                  «      t        |
«      z  }|rt        d|› d�«      ‚t        | t        j                  «      rt        | |d¬«      }nt        dt        | «      «      }t        |t        j                  «      rt        ||d¬«      }nt        dt        |«      «      }t        |||||«      }t        d|||g¬«      }|j!                  |¬	«      }|t        k(  r|S |t        j"                  k(  rt        j"                  |«      S t	        d
«      ‚c c}	w )a-  
    Perform asof join of two tables or datasets.

    The result will be an output table with the result of the join operation

    Parameters
    ----------
    left_operand : Table or Dataset
        The left operand for the join operation.
    left_on : str
        The left key (or keys) on which the join operation should be performed.
    left_by: str or list[str]
        The left key (or keys) on which the join operation should be performed.
    right_operand : Table or Dataset
        The right operand for the join operation.
    right_on : str or list[str]
        The right key (or keys) on which the join operation should be performed.
    right_by: str or list[str]
        The right key (or keys) on which the join operation should be performed.
    tolerance : int
        The tolerance to use for the asof join. The tolerance is interpreted in
        the same units as the "on" key.
    output_type: Table or InMemoryDataset
        The output type for the exec plan result.

    Returns
    -------
    result_table : Table or InMemoryDataset
    r6   zColumns zE present in both tables. AsofJoin does not support column collisions.Tr%   r9   Úasofjoinr?   r8   rC   )rD   r   rE   r   rF   rG   rH   rI   r*   r+   rK   Ú
ValueErrorr4   r   r
   r   rP   r"   )rR   Úleft_onÚleft_byrT   Úright_onÚright_byÚ	tolerancer&   rY   r`   r_   Úcolumns_collisionsrd   re   rf   r0   rm   s                    r   Ú_perform_join_asofrx     sú  € ôB �l¤U¬B¯J©JÐ$7Ô8ÜÐ9¼$¸|Ó:LÐ9MÐNÓOÐOÜ�m¤e¬R¯Z©ZÐ%8Ô9ÜÐ9¼$¸}Ó:MÐ9NÐOÓPÐPä�g¤¤t˜}Ô-Ø�)ˆÜ�h¤¬ Ô.Ø�:ˆð %×+Ñ+×1Ñ1öØØ�x�j 8Ñ+Ñ+ò 	ð€Mð ô ˜\×0Ñ0×6Ñ6Ó7¼#¸mÓ:LÑLÐÙÜØÐ)Ð*ð +;ð ;ó
ð 	
ô �,¤§
¡
Ô+Ü&ØØ#Ø"ô$‰ô
 "ØÔ2°<Ó@ó
ˆô �-¤§¡Ô,Ü'Ø {Ø"ô$‰ô #ØÔ2°=ÓAó
ˆô $Ø�˜( H¨ió€Iô Ø˜I¨{¸LÐ.Iô€Dð —=‘=¨[�=Ó9€Là”eÒØÐØ	œ×*Ñ*Ò	*Ü×!Ñ! ,Ó/Ð/äÐ1Ó2Ð2ùòYs   Â9G3c           	      ó  — d}t        | t        «      rt        j                  | g«      } d}t	        j
                  t	        dt        | «      ¬«      t	        dt        |«      ¬«      g«      }|j                  d¬«      }|r�|j                  dkD  r#|j                  «       j                  «       d   }|S |j                  D �cg c]  }t        g |j                  ¬«      ‘Œ }}t        j                  ||j                  ¬	«      }|S c c}w )
aŒ  Filter rows of a table based on the provided expression.

    The result will be an output table with only the rows matching
    the provided expression.

    Parameters
    ----------
    table : Table or RecordBatch
        Table that should be filtered.
    expression : Expression
        The expression on which rows should be filtered.

    Returns
    -------
    Table or RecordBatch
    FTr9   )r@   r)   r8   r   )rG   )r*   )rD   r   r   Úfrom_batchesr   r,   r
   r   rP   Únum_rowsÚcombine_chunksÚ
to_batchesr*   r   rG   Úfrom_arrays)ÚtableÚ
expressionÚis_batchr0   Úresultr   Úarrayss          r   Ú_filter_tabler„   b  sé   € ð" €HÜ�%œÔ%Ü×"Ñ" E 7Ó+ˆØˆä×$Ñ$Ü�NÔ,BÀ5Ó,IÔJÜ�HÔ&7¸
Ó&CÔDð&ó €Dð �]‰] tˆ]Ó,€FÙØ�?‰?˜QÒØ×*Ñ*Ó,×7Ñ7Ó9¸!Ñ<ˆFð €Mð ?E¿m¹mÖL°U”e˜B U§Z¡ZÖ0ÐLˆFÐLÜ ×,Ñ,¨V¸F¿M¹MÔJˆFØ€Mùò Ms   Â>Dc                 óv  — t        | t        j                  «      rt        | d¬«      }nt	        dt        | «      «      }t	        dt        |fi |¤Ž«      }t	        j                  ||g«      }|j                  d¬«      }|t        k(  r|S |t        j                  k(  rt        j                  |«      S t        d«      ‚)NTr8   r9   Úorder_byrC   )rD   rE   r   r4   r   r
   r   r,   rP   r   r"   rF   )Útable_or_datasetÚ	sort_keysrY   ÚkwargsÚdata_sourcer†   r0   rm   s           r   Ú_sort_sourcer‹   †  s«   € äÐ"¤B§J¡JÔ/Ü&Ð'7ÀTÔJ‰ä!ØÔ2Ð3CÓDó
ˆô ˜:Ô'9¸)Ñ'NÀvÑ'NÓO€Hä×$Ñ$ k°8Ð%<Ó=€DØ—=‘=¨T�=Ó2€Là”eÒØÐØ	œ×*Ñ*Ò	*Ü×!Ñ! ,Ó/Ð/äÐ1Ó2Ð2r   c           
      ó¤   — t        j                  t        dt        | «      «      t        dt        ||¬«      «      g«      }|j	                  |¬«      S )Nr9   Ú	aggregate)Úkeysr8   )r   r,   r
   r   rP   )r   Ú
aggregatesrŽ   r&   r0   s        r   Ú	_group_byr�   œ  sL   € ä×$Ñ$Ü�NÔ$:¸5Ó$AÓBÜ�KÔ!5°jÀtÔ!LÓMð&ó €Dð �=‰= [ˆ=Ó1Ð1r   )TF)T) Úpyarrow.libr   r   r   Úpyarrow.computer   r   Úpyarrow._aceror   r	   r
   r   r   r   r   r   r   ÚImportErrorÚexcÚstrÚpyarrow.datasetr/   rE   Úpyarrow._datasetr   r   r4   rn   rx   r„   r‹   r�   r   r   r   ú<module>r™      sÆ   ð÷2 2Ñ 1ß -ð÷
÷ 
õ 
ð"
Ý Ý0óð2 #°Ø"°%Ø#°tó	r3ðn /3Ø#(óX3òv!ðH ;@ó 3ô,2øði ò Ù
Ø
JÉ3ÈsË8È*ÐTUÐVóàðûðûð ò ÷ñ ð 
‚Bðús(   ”A «A8 ÁA5ÁA0Á0A5Á8BÂB