+
    nDjf                        ^ RI t ^ RIt^ RIt^ RIt ^ RIHt ^ RIt ^ RI	t
^ RIHt ]P                  P                  ]RJ RR7      t]P"                  ! ]RR7      t]P"                  ! ]RR7      t]P"                  ! ]RR7      tR	 t] P.                  R
 4       t ! R R]P2                  4      tR tR tR tR tR tR t R t!]R 4       t"]R 4       t#R t$]R 4       t%]R 4       t&RAR lt']R 4       t(]R 4       t)]R 4       t*R t+]R 4       t,]R 4       t-]R  4       t.R! t/R" t0R# t1]]P                  Pe                  R$]0]1.4      R% 4       4       t3]R& 4       t4]R' 4       t5]P                  Pe                  R(]Pl                  ! 4       ]Pn                  ! R)]Pl                  ! 4       4      ]Pp                  ! R)]Pl                  ! 4       /4      .. RBOR*7      R+ 4       t9]P                  Pe                  R,]Pt                  ! . RCO4      R- ]Pl                  ! 4       ]Pv                  ! 4       3]Px                  ! ]Pt                  ! . RCO4      .R..R/7      R0 ]Pp                  ! R.]Pl                  ! 4       /4      ]Pp                  ! R.]Pv                  ! 4       /4      3.R1R2.R*7      R3 4       t=]P                  Pe                  R,]Pt                  ! . RCO4      R4 ]Pl                  ! 4       ]Pv                  ! 4       3]Px                  ! ]Pt                  ! . RCO4      .R..R/7      R5 ]Pp                  ! R.]Pl                  ! 4       /4      ]Pp                  ! R.]Pv                  ! 4       /4      3.R1R2.R*7      R6 4       t>]P                  Pe                  R7]P~                  P                  R8 .R9R:.R*7      R; 4       tAR< tBR= tCR> tDR? tE]R@ 4       tFR#   ] d    Rt ELi ; i  ] d	    R;t
t ELi ; i)D    N)ffiz!test needs cffi package installed)reasonz"Cannot import released ArrowSchemamatchz!Cannot import released ArrowArrayz#Cannot import released Arrow Streamc                 p    \         P                  P                  \         P                  ! V 4      V4      ^8H  #    )ctypes	pythonapiPyCapsule_IsValid	py_object)capsulenames   &&Q/data/cameron/venvs/s3viz/lib/python3.14/site-packages/pyarrow/tests/test_cffi.pyr   r   3   s,    --f.>.>w.GNRSSS    c              #      "   \         P                  ! V 4        R x  \         P                  ! V P                  4       R #   \         P                  ! T P                  4       i ; i5iN)paregister_extension_typeunregister_extension_typeextension_name)ext_types   &r   registered_extension_typer   7   sC     x(>
$$X%<%<=$$X%<%<=s   A%A  "A% "A""A%c                   X   a a ] tR t^@t oV 3R lt]R 4       tR t]R 4       t	Rt
VtV ;t# )ParamExtTypec                \   < Wn         \        SV `	  \        P                  ! V4      R 4       R# )z$pyarrow.tests.test_cffi.ParamExtTypeN)_widthsuper__init__r   binary)selfwidth	__class__s   &&r   r   ParamExtType.__init__B   s$    5)?	Ar   c                    V P                   # r   r   r!   s   &r   r"   ParamExtType.widthG   s    {{r   c                H    \        V P                  4      P                  4       # r   )strr"   encoder'   s   &r   __arrow_ext_serialize__$ParamExtType.__arrow_ext_serialize__K   s    4::%%''r   c                D    \        VP                  4       4      pV ! V4      # r   )intdecode)clsstorage_type
serializedr"   s   &&& r   __arrow_ext_deserialize__&ParamExtType.__arrow_ext_deserialize__N   s    J%%'(5zr   r&   )__name__
__module____qualname____firstlineno__r   propertyr"   r,   classmethodr4   __static_attributes____classdictcell____classcell__)r#   __classdict__s   @@r   r   r   @   s=     A
  (   r   r   c                      \         P                  ! R \         P                  ! \         P                  ! 4       4      3.RR/R7      # )ints   key1   value1metadata)r   schemalist_int32 r   r   make_schemarJ   T   s4    99vrxx
345&	24 4r   c                  N    \         P                  ! R \        ^4      3.RR/R7      # extrB   rC   rD   )r   rF   r   rI   r   r   make_extension_schemarN   Y   s)    99ul1o./&	24 4r   c                  b    \         P                  ! R \        ^4      P                  3.RR/R7      # rL   )r   rF   r   r2   rI   r   r   make_extension_storage_schemarP   ^   s/    99ul1o::;<&	24 4r   c                  L    \         P                  ! ^.^^*...\        4       4      # r   )r   record_batchrJ   rI   r   r   
make_batchrS   d   s"    ??aS1b'N+[];;r   c                      \        4       p V ^ ,          P                  P                  \        P                  ! RR.\        P
                  ! ^4      R7      4      p\        P                  ! V.V 4      # )r   s   foos   bartype)rN   rV   
wrap_arrayr   arrayr    rR   )rF   ext_cols     r   make_extension_batchrZ   h   sT    "$FQinn''&&1A68iil)D EG??G9f--r   c                      \        4       p \        P                  ! ^.^^*...V 4      \        P                  ! R. ^^...V 4      .# r	   N)rJ   r   rR   rF   s    r   make_batchesr^   o   sJ    ]F
1#2w(&1
$QF+,f5 r   c           	      T   \         P                  ! 4       ;_uu_ 4       p\         P                  P                  W 4      ;_uu_ 4       pV F  pVP	                  V4       K  	  R R R 4       VP                  4       uuR R R 4       #   + '       g   i     L*; i  + '       g   i     R # ; ir   )r   BufferOutputStreamipc
new_streamwritegetvalue)rF   batchessinkoutbatchs   &&   r   make_serializedri   w   sk    				 	 DVVt,, 		%  ! - }}	 
!	 ,, 
!	 	 s#   (BB	!BBBB'	c                     \         P                  ! R 4      p \        \         P                  ! RV 4      4      p\        P
                  ! 4        \        P                  ! 4       p\        P                  ! \        P                  ! 4       4      pVP                  V4       \        P                  ! 4       V8  g   Q h?\        P                  ! 4       V8  g   Q h\        P                  P                  V4      pV\        P                  ! \        P                  ! 4       4      8X  g   Q h\        P                  ! 4       V8X  g   Q h\        ;_uu_ 4        \        P                  P                  V4       RRR4       \        P                  ! 4       P                  V4       \         P                  ! RR4      pWPn        \        P                   ! \"        RR7      ;_uu_ 4        \        P                  P                  V4       RRR4       \        ;_uu_ 4        \        P                  P                  V4       RRR4       R#   + '       g   i     L; i  + '       g   i     L[; i  + '       g   i     R# ; i)struct ArrowSchema*	uintptr_tNzchar[]s   zzzz$Invalid or unsupported format stringr   )r   newr/   castgccollectr   total_allocated_bytesrG   rH   _export_to_cDataType_import_from_cassert_schema_releasedformatpytestraises
ValueError)c_schema
ptr_schemaold_allocatedtyptyp_new
bad_formats         r   test_export_import_typer      s   ww,-HSXXk845JJJL,,.M
((288:
CZ ##%555##%555kk((4Gbhhrxxz****##%666		
"":. 
  HHJJ'6*J O	zC
E 
E
"":.
E 
 	
"":. 
 	 
 	
E 
E 
 		s$    H: I I :I
	I	 I1	c                  r   \         P                  ! R 4      p \        \         P                  ! RV 4      4      p\        P
                  ! 4        \        P                  ! 4       p\        P                  ! R\        P                  ! \        P                  ! 4       4      RR7      pVP                  V4       \        P                  ! 4       V8  g   Q h?\        P                  ! 4       V8  g   Q h\        P                  P                  V4      pV\        P                  ! R\        P                  ! \        P                  ! 4       4      RR7      8X  g   Q h\        P                  ! 4       V8X  g   Q h\        ;_uu_ 4        \        P                  P                  V4       RRR4       R#   + '       g   i     R# ; i)rk   rl   testT)nullableN)r   rm   r/   rn   ro   rp   r   rq   fieldrG   rH   rr   Fieldrt   ru   )rz   r{   r|   r   	field_news        r   test_export_import_fieldr      s   ww,-HSXXk845JJJL,,.MHHVRXXbhhj1DAE	z"##%555##%555''
3I"((*)=MMMM##%666 
 	

+ 
 			s   ; F%%F6	c           	      R   \         P                  ! R 4      p\        \         P                  ! RV4      4      p\         P                  ! RV  R24      p\        \         P                  ! RV4      4      p\        P
                  ! 4        \        P                  ! 4       p\        P                  ! \        P                  ! 4       4      p\        P                  ! ^.^^*..VR7      p	V	P                  4       p
V! W4       \        P                  ! 4       V8  g   Q h?	V! Wh4      pVP                  4       V
8X  g   Q hVP                  \        P                  ! \        P                  ! 4       4      8X  g   Q h\        P                  ! 4       V8  g   Q h??\        P                  ! 4       V8X  g   Q h\        ;_uu_ 4        V! V\        P                  ! \        P                  ! 4       4      4       RRR4       \        P                  ! ^.^^*..\        P                  ! \        P                  ! 4       4      R7      p	V	P                  4       p
V! WV4       ?	V! Wd4      pVP                  4       V
8X  g   Q hVP                  \        P                  ! \        P                  ! 4       4      8X  g   Q h\        P                  ! 4       V8  g   Q h?\        P                  ! 4       V8X  g   Q h\        ;_uu_ 4        V! Wd4       RRR4       R#   + '       g   i     EL"; i  + '       g   i     R# ; i)rk   rl   struct *rU   N)r   rm   r/   rn   ro   rp   r   rq   rG   rH   rX   	to_pylistrV   assert_array_releasedru   )
array_typeexporterimporterrz   r{   c_array	ptr_arrayr|   r}   arrpy_valuearr_news   &&&         r   check_export_import_arrayr      sC   ww,-HSXXk845Jgg
|1-.GCHH['23IJJL,,.M ((288:
C
((QC!R>
,C}}HS##%555y&G(***<<288BHHJ////##%555##%666		BHHRXXZ01 
 ((QC!R>(<
=C}}HSZ(y-G(***<<288BHHJ////##%555##%666		' 
 	! 
		  
 		s   71L.	LL	L&	c                      \        R \        P                  P                  \        P                  P                  4       R# 
ArrowArrayN)r   r   Arrayrr   rt   rI   r   r   test_export_import_arrayr      s'    

r   c                     \        R \        P                  P                  \        P                  P                  4       \
        P                  ! R4      p \        \
        P                  ! RV 4      4      p\        P                  ! ^.^^*..\        P                  ! \        P                  ! 4       4      R7      pVP                  V4       V P                  ^8X  g   Q hV P                  R8X  g   Q hV P                  P                  ^8X  g   Q hR# )ArrowDeviceArraystruct ArrowDeviceArray*rl   rU   N)r   r   r   _export_to_c_device_import_from_c_devicer   rm   r/   rn   rX   rG   rH   device_type	device_idlength)r   r   r   s      r   test_export_import_device_arrayr      s    
$$
&& gg01GCHH['23I
((QC!R>(<
=CI&!###"""==1$$$r   c                 ,   Vf   T p\         P                  ! R4      p\        \         P                  ! RV4      4      p\        P
                  ! 4        \        P                  ! 4       pV ! 4       P                  V4       \        P                  ! 4       V8  g   Q h\        P                  P                  V4      pWQ! 4       8X  g   Q h\        P                  ! 4       V8X  g   Q h?\        P                  ! 4       V8X  g   Q h\        ;_uu_ 4        \        P                  P                  V4       R R R 4       \        P                  ! 4       P                  V4       \        P                  ! \        RR7      ;_uu_ 4        \        P                  P                  V4       R R R 4       \        ;_uu_ 4        \        P                  P                  V4       R R R 4       R #   + '       g   i     L; i  + '       g   i     L[; i  + '       g   i     R # ; i)Nrk   rl   %ArrowSchema describes non-struct typer   )r   rm   r/   rn   ro   rp   r   rq   rr   Schemart   ru   rH   rw   rx   ry   )schema_factoryexpected_schema_factoryrz   r{   r|   
schema_news   &&    r   check_export_import_schemar      so   &"0ww,-HSXXk845JJJL,,.M!!*-##%555))*5J02222##%666##%666		
		  , 
  HHJJ'	zD
F 
F
		  ,
F 
 	
		  , 
 	 
 	

F 
F 
 		s$    G< G/2 HG,	/G?	H	c                  $    \        \        4       R # r   )r   rJ   rI   r   r   test_export_import_schemar      s
    {+r   c                      \        \        \        4       \        \	        ^4      4      ;_uu_ 4        \        \        4       RRR4       R#   + '       g   i     R# ; ir\   )r   rN   rP   r   r   rI   r   r   (test_export_import_schema_with_extensionr   %  s;     4<> 
#<?	3	3"#89 
4	3	3	3s   AA	c                  ,   \         P                  ! R 4      p \        \         P                  ! RV 4      4      pRp\        P
                  ! \        VR7      ;_uu_ 4        \        4       P                  \        V4      4       RRR4       \        P
                  ! \        VR7      ;_uu_ 4        \        P                  P                  \        V4      4      pRRR4       X\        4       8X  g   Q hR#   + '       g   i     Lx; i  + '       g   i     L6; i)rk   rl   z,Passing a pointer value as a float is unsafer   N)r   rm   r/   rn   rw   warnsUserWarningrJ   rr   floatr   r   rt   )rz   r{   r   r   s       r   'test_export_import_schema_float_pointerr   0  s     ww,-HSXXk845J:E	k	/	/""5#45 
0	k	/	/YY--eJ.?@
 
0&&&	 
0	/	/	/s   #C0,)D0D 	D	c                 .   \         P                  ! R 4      p\        \         P                  ! RV4      4      p\         P                  ! RV  R24      p\        \         P                  ! RV4      4      p\        P
                  ! 4        \        P                  ! 4       pV! 4       p	V	P                  p
V	P                  4       pV! W4       \        P                  ! 4       V8  g   Q h?	V! Wz4      pVP                  4       V8X  g   Q hVP                  V
8X  g   Q h\        P                  ! 4       V8  g   Q h??
\        P                  ! 4       V8X  g   Q h\        ;_uu_ 4        V! V\        4       4       RRR4       V! 4       p	V	P                  4       pV	P                  Wu4       ?	V! Wu4      pVP                  4       V8X  g   Q hVP                  V! 4       P                  8X  g   Q h\        P                  ! 4       V8  g   Q h?\        P                  ! 4       V8X  g   Q h\        ;_uu_ 4        V! Wu4       RRR4       \        P                  ! 4       P                  V4       V! 4       P                  V4       \        P                   ! \"        RR7      ;_uu_ 4        V! Wu4       RRR4       \        ;_uu_ 4        V! Wu4       RRR4       R#   + '       g   i     ELc; i  + '       g   i     L; i  + '       g   i     LX; i  + '       g   i     R# ; i)rk   rl   r   r   Nr   r   )r   rm   r/   rn   ro   rp   r   rq   rF   	to_pydictr   rJ   rr   ru   rH   rw   rx   ry   )r   r   r   batch_factoryrz   r{   r   r   r|   rh   rF   r   	batch_news   &&&&         r   check_export_import_batchr   ?  sa   ww,-HSXXk845Jgg
|1-.GCHH['23IJJL,,.M OE\\F HU##%555+I H,,,v%%%##%5556##%666		KM* 
 OE H	y-/I H,,,}55555##%555##%666		' 
  HHJJ'O  +	zD
F 
F'
F 
 	' 
 	5 
		  
 	
F 
F 
 		s0   K	(	K	K06	L	K	K-	0L 	L	c                      \        R \        P                  P                  \        P                  P                  \
        4       R# r   )r   r   RecordBatchrr   rt   rS   rI   r   r   test_export_import_batchr   u  s*    
##
%%	r   c                      \        \        ^4      4      ;_uu_ 4        \        R\        P                  P
                  \        P                  P                  \        4       RRR4       R#   + '       g   i     R# ; i)r	   r   N)r   r   r   r   r   rr   rt   rZ   rI   r   r   'test_export_import_batch_with_extensionr     sH    	"<?	3	3!NN''NN)) 		
 
4	3	3	3s   AA**A;	c                     \        R \        P                  P                  \        P                  P                  \
        4       \        P                  ! R4      p \        \        P                  ! RV 4      4      p\        4       pVP                  V4       V P                  ^8X  g   Q hV P                  R8X  g   Q hV P                  P                  ^8X  g   Q hR# )r   r   rl   Nr   )r   r   r   r   r   rS   r   rm   r/   rn   r   r   rX   r   )r   r   rh   s      r   test_export_import_device_batchr     s    
**
,,	 gg01GCHH['23ILE	i(!###"""==1$$$r   c                 ~   \        4       pV^ ,          P                  pV! W24      pVP                  V 4       ??\        P                  P                  V 4      pVP                  V8X  g   Q h\        V4      p?V\        4       8X  g   Q h\        e   \        4       pV^ ,          P                  p\        P                  P                  V4      P                  4       pV! W24      pVP                  V 4       ??\        P                  P                  V 4      pVP                  4       p?\        P                  ! Wx4       R# R# )r   N)r^   rF   rr   r   RecordBatchReaderrt   listpdTablefrom_batches	to_pandasread_pandastmassert_frame_equal)	
ptr_streamreader_factoryre   rF   reader
reader_newgot_batchesexpected_dfgot_dfs	   &&       r   _export_import_batch_readerr     s   nGQZFF,F

#%%44Z@J&&&z"K,.((( 
~.""hh++G4>>@0J'G))88D
'')
k2 r   c                 R    \         P                  P                  \        W4      4      # r   )r   ra   open_streamri   rF   re   s   &&r   make_ipc_stream_readerr     s    66of>??r   c                 @    \         P                  P                  W4      # r   )r   r   r   r   s   &&r   make_py_record_batch_readerr     s    ,,V==r   r   c                    \         P                  ! R 4      p\        \         P                  ! RV4      4      p\        P
                  ! 4        \        P                  ! 4       p\        W 4       \        P                  ! 4       V8X  g   Q h\        ;_uu_ 4        \        P                  P                  V4       RRR4       R#   + '       g   i     R# ; i)struct ArrowArrayStream*rl   N)r   rm   r/   rn   ro   rp   r   rq   r   assert_stream_releasedr   rt   )r   c_streamr   r|   s   &   r   test_export_import_batch_readerr     s    
 ww12HSXXk845JJJL,,.M
;##%666 
 	
++J7 
 			s    C  C	c                     \         P                  ! R 4      p \        \         P                  ! RV 4      4      p\        P
                  ! 4        \        P                  ! 4       pR p\        P                  P                  \        4       V! 4       4      pVP                  V4       \        P                  P                  V4      p\        P                  ! \        4      ;_uu_ 4       pVP!                  4        RRR4       R\#        XP$                  4      9   g   Q hR\#        VP$                  4      9   g   Q hR\#        VP$                  4      9   g   Q h\        P                  ! 4       V8X  g   Q hR#   + '       g   i     L; i)r   rl   c               3   b   "     \        R4      h  \          d   p \        R4      T hRp ? ii ; i5i)TfoobarN)ry   NotImplementedErrorr^   )es    r   gen0test_export_import_exception_reader.<locals>.gen  s4     8 '' 8)%0a78s   / ,',/NzValueError: foozNotImplementedError: barzraise ValueError('foo'))r   rm   r/   rn   ro   rp   r   rq   r   r   rJ   rr   rt   rw   rx   r   read_next_batchr*   value)r   r   r|   r   originalr   exc_infos          r   #test_export_import_exception_readerr     s    ww12HSXXk845JJJL,,.M& ##00FH*%!!00<F	*	+	+x  
, HNN 3333%X^^)<<<<&#hnn*====##%666 
,	+s   #E..E>	c                     \         P                  ! R 4      p \        \         P                  ! RV 4      4      p\        P
                  ! R\        P                  ! 4       3.4      p\        P                  ! . RO.VR7      \        P                  ! . RO.VR7      .p\        W#4      p\        P                  P                  VRR	 4      pVP                  V4       ?\        P                  P                  V4      pVP                  4       pWs^ ,          8X  g   Q h\        P                   ! \"        RR7      ;_uu_ 4        VP                  4        RRR4       \        P                  P                  VRR	 4      pVP                  V4       ?\        P                  P                  V4      p\        P                   ! \"        RR7      ;_uu_ 4        VP%                  4        RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)
r   rl   r   r]   Nz<Expected to be able to read 16 bytes for message body, got 8r   r	         )         i)r   rm   r/   rn   r   rF   rH   rR   ri   ra   r   rr   r   rt   r   rw   rx   OSErrorread_all)r   r   rF   re   bufr   r   rh   s           r    test_imported_batch_reader_errorr     s   ww12HSXXk845JYY
+,-F	{6:	{6:<G
&
*C VVDS	*F

#%%44Z@J&&(EAJ	w7
8 
8 	""$
8 VVDS	*F

#%%44Z@J	w7
8 
8 	
8 
8
8 
8
8 
8 
8s   :G%
G8%G5	8H		objr   )idsc                    \         P                  ! 4        \        P                  ! 4       pV P	                  4       p\        VR 4      ^8X  g   Q h\        P                  ! 4       V8  g   Q h\        V 4      P                  V4      pW08X  g   Q h\        P                  ! 4       V8X  g   Q hV P	                  4       p\        P                  ! 4       V8  g   Q h?\        P                  ! 4       V8X  g   Q hR# )   arrow_schemaN)ro   rp   r   rq   __arrow_c_schema__r   rV   _import_from_c_capsule)r   r|   r   obj_outs   &   r   test_roundtrip_schema_capsuler     s     JJL,,.M$$&GWo6!;;;##%5553i..w7G>>##%666$$&G##%555##%666r   z&arr,schema_accessor,bad_type,good_typec                     V P                   # r   rU   xs   &r   <lambda>r  5      !&&r   r   )namesc                     V P                   # r   r]   r   s   &r   r  r  8      !((r   rX   rR   c                 h   \         P                  ! 4        \        P                  ! 4       p\	        V 4      P
                  pV P                  4       w  rg\        VR 4      ^8X  g   Q h\        VR4      ^8X  g   Q hV! Wg4      pVP                  V 4      '       g   Q h\        P                  ! 4       V8  g   Q h?\        P                  ! 4       V8X  g   Q hV P                  4       p\        P                  ! 4       V8  g   Q h?\        P                  ! 4       V8X  g   Q h\        P                  ! \        RR7      ;_uu_ 4        V P                  VP                  4       4       RRR4       V P                  VP                  4       4      w  riV! Wi4      pV! V4      V8X  g   Q hR#   + '       g   i     LJ; i)r   s   arrow_array-Could not cast.* string to requested .* int32r   N)ro   rp   r   rq   rV   r   __arrow_c_array__r   equalsrw   rx   ry   r   
r   schema_accessorbad_type	good_typer|   import_arrayschema_capsuler   arr_outarray_capsules
   &&&&      r   test_roundtrip_array_capsuler  4  st    JJL,,.M933L!335N^_=BBBWn5:::>3G>>###%555##%666##%G##%555##%666	zM
O 
Oh99;<
O %($9$9$$&%(!N>9G7#y000
O 
O   ? F!!F1	c                     V P                   # r   rU   r   s   &r   r  r  _  r  r   c                     V P                   # r   r]   r   s   &r   r  r  b  r  r   c                 h   \         P                  ! 4        \        P                  ! 4       p\	        V 4      P
                  pV P                  4       w  rg\        VR 4      ^8X  g   Q h\        VR4      ^8X  g   Q hV! Wg4      pVP                  V 4      '       g   Q h\        P                  ! 4       V8  g   Q h?\        P                  ! 4       V8X  g   Q hV P                  4       p\        P                  ! 4       V8  g   Q h?\        P                  ! 4       V8X  g   Q h\        P                  ! \        RR7      ;_uu_ 4        V P                  VP                  4       4       RRR4       V P                  VP                  4       4      w  riV! Wi4      pV! V4      V8X  g   Q hR#   + '       g   i     LJ; i)r   s   arrow_device_arrayr  r   N)ro   rp   r   rq   rV   _import_from_c_device_capsule__arrow_c_device_array__r   r	  r  rw   rx   ry   r   r
  s
   &&&&      r   #test_roundtrip_device_array_capsuler  ^  su    JJL,,.M9::L!::<N^_=BBBW&;<AAA>3G>>###%555##%666##%G##%555##%666	zM
O 
O$$X%@%@%BC
O %($@$@$$&%(!N>9G7#y000
O 
Or  constructorc                 @    \         P                  P                  W4      # r   )r   r   r   r   s   &&r   r  r    s    BHH11'Br   recordbatchreadertablec                    \        4       pV^ ,          P                  p\        P                  ! 4        \        P
                  ! 4       pV ! W!4      pVP                  4       p\        VR4      ^8X  g   Q h\        P                  P                  V4      pVP                  V8X  g   Q h\        V4      p\        V4      \        V4      8X  g   Q h\        Wq4       F  w  rVP                  V	4      '       d   K  Q h	  ????	?\        P
                  ! 4       V8X  g   Q hV ! W!4      p\        P                  ! R\        P                  ! 4       /4      p
\        P                   ! \        P"                  P$                  RR7      ;_uu_ 4        VP                  V
P'                  4       4       RRR4       \        P                  ! R\        P(                  ! \        P                  ! 4       4      /4      pVP                  VP'                  4       4      p\        P                  P                  V4      pVP                  V8X  g   Q h\        Wa4       F  w  rVP                  V	4      '       d   K  Q h	  R#   + '       g   i     L; i)r      arrow_array_streamrA   zField 0 cannot be castr   N)r^   rF   ro   rp   r   rq   __arrow_c_stream__r   r   r   r   lenzipr	  rH   rw   rx   libArrowTypeErrorr   rG   )r  re   rF   r|   r   r   imported_readerimported_batchesrh   expected
bad_schemamatching_schemas   &           r   test_roundtrip_reader_capsuler*    s    nGQZFJJL,,.M
f
&C$$&GW&;<AAA**AA'JO!!V+++O, CL000/9||H%%%% : 	_eX/?##%666
f
&CFBHHJ/0J	rvv,,4L	M	Mz<<>? 
N ii"((*)= >?O$$_%G%G%IJG**AA'JO!!_4448||H%%%% 9 
N	Ms    I++I;	c                  t   \        4       p \        P                  ! R \        P                  ! \        P                  ! 4       4      3.4      pVP                  4       pV P                  V4      pV P                  V4      p\        VR4      ^8X  g   Q h\        P                  P                  V4      pVP                  V8X  g   Q hVP                  4       P                  V4      '       g   Q h\        P                  ! \        4      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     R# ; i)rA   r  N)rS   r   rF   rG   int64r   rn   r   r   r   r   r   r	  rw   rx   StopIteration)rh   requested_schemarequested_capsulebatch_as_requestedr   r%  s         r   4test_roundtrip_batch_reader_capsule_requested_schemar1    s    LEyy6288BHHJ+?"@!AB(;;=$45&&'89GW&;<AAA**AA'JO!!%5555**,334FGGGG	}	%	%'') 
&	%	%	%s   D&&D7	c                     \        4       p V P                  4       p\        VR 4      ^8X  g   Q h\        P                  P                  V4      pVP                  V P                  8X  g   Q hVP                  4       P                  V 4      '       g   Q h\        P                  ! \        4      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     R# ; i)r  N)rS   r   r   r   r   r   rF   r   r	  rw   rx   r-  )rh   r   r%  s      r   #test_roundtrip_batch_reader_capsuler3    s    LE&&(GW&;<AAA**AA'JO!!U\\111**,33E::::	}	%	%'') 
&	%	%	%s   3CC	c                  .   \         P                  ! \         P                  ! . RO4      .4      p V P                  4       p\	        VR4      ^8X  g   Q h\         P
                  P                  V4      pVP                  V P                  8X  g   Q hW 8X  g   Q hR# )ar  Nr5  bc)r   chunked_arrayrX   r   r   ChunkedArrayr   rV   )chunkedr   imported_chunkeds      r   $test_roundtrip_chunked_array_capsuler=    s{     9:;G((*GW&;<AAA==gF  GLL000&&&r   c                     \         P                  ! \         P                  ! . RO4      .4      p V P                  P	                  4       pV P                  V4      p\         P                  P                  V4      pW08X  g   Q h\         P                  ! 4       pVP	                  4       pV P                  V4      p\         P                  P                  V4      pW0P                  \         P                  ! 4       4      8X  g   Q h\         P                  ! 4       pVP	                  4       p\        P                  ! \        RR7      ;_uu_ 4        V P                  V4       RRR4       R#   + '       g   i     R# ; i)r5  z-Could not cast string to requested type int64r   Nr6  )r   r9  rX   rV   r   r   r:  r   r    rn   r,  rw   rx   ry   )r;  r/  r   r<  requested_types        r   5test_roundtrip_chunked_array_capsule_requested_schemar@    s    9:;G  779(():;G==gF&&& YY[N&99;(():;G==gF||BIIK8888XXZN&99;	I
 
 	""#45
 
 
 
s   E$$E5	c                  (    ^ RI p \        P                  ! R4       \        P
                  ! R4      p\        \        P                  ! RV4      4      p\        P                  ! . RO\        P                  ! 4       R7      pVP                  V4       ^Vn        \        P                  ! \        RR7      ;_uu_ 4        \        P                  P                  W#P                   4       RRR4       R#   \         d     Li ; i  + '       g   i     R# ; i)	r   Nzpyarrow.cuda is availabler   rl   rU   z&Trying to import data on a CUDA devicer   r   )pyarrow.cudarw   skipImportErrorr   rm   r/   rn   r   rX   r,  r   r   rx   r   r   rV   )pyarrowr   r   r   s       r   test_import_device_no_cudarF    s    1 	/0gg01GCHH['23I
((9288:
.CI& G	{*R	S	S
&&y((; 
T	S   
T	S	Ss   C/ ;*D /C=<C= D	r   )rV   r   rF   r6  )G
contextlibr
   ro   rE  r   pyarrow.cffir   rD  rw   pandasr   pandas.testingtestingr   markskipif
needs_cffirx   ry   ru   r   r   r   contextmanagerr   ExtensionTyper   rJ   rN   rP   rS   rZ   r^   ri   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   parametrizer   r   r   rH   r   rF   r   rX   stringrR   r  r  r   r   r*  r1  r3  r=  r@  rF  rI   r   r   <module>rS     s  &   	   
 [[t'J   L
  :<  9;   ;= T > >2## (4
4
4<. / /@ , ,.)(X   % %$-@ , , : : ' '3(l   
 
 % %$3@@> )057888 8  7 7B  D RXXeRXXZ-H!#E288:+>!?!A8  :7:7& AXXo 0"((*biikJ
/23C5A
		3
#$
		3		$%	D 	   "1"1B AXXo 0"((*biikJ
/23C5A
		3
#$
		3		$%	D 	   "1"1B %%B) 	W%	  '
"&'
"&J*	*'60 < <m  
C  NBs"   N> 
O >	O
OOO