+
    nDj                     &   ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	 ^ RI
t^ RIt^ RIHtHt  ^ RIHt ^ RIt ! R R4      t ! R R]4      t ! R	 R
]4      t ! R R]4      t]P4                  R 4       t]P4                  R 4       t]P4                  R 4       t]P4                  ! ]P<                  ! RRR7      ]P<                  ! RRR7      .R7      R 4       tR t R t!R t"]PF                  PI                  RR R .4      R 4       t%R t&]PF                  P(                  R 4       t'R  t(R! t)]PF                  P(                  ]PF                  PT                  R" 4       4       t+]PF                  P(                  R# 4       t,R$ t-]PF                  PI                  R%]P\                  P_                  4       ]P\                  P_                  R&R'7      .4      R( 4       t0R) t1]PF                  PI                  R%]P\                  P_                  4       ]P\                  P_                  R&R'7      .4      R* 4       t2R+ t3]PF                  P(                  R, 4       t4]PF                  P(                  R- 4       t5R. t6]PF                  Pn                  R/ 4       t8R0 t9]PF                  PI                  R%]P\                  Pu                  4       ]P\                  Pu                  R1R27      ]P\                  Pu                  R1R37      ]P\                  Pu                  ]P\                  Pv                  Px                  R47      ]P\                  Pu                  R1]P\                  Pv                  Px                  R57      .4      R6 4       t=R7 t>R8 t?R9 t@R: tAR; tB]PF                  P(                  R< 4       tC]P4                  R= 4       tDR> tER? tFR@ tGRA tH]PF                  P                  RB 4       tJRC tKRD tLRE tM ! RF RG]P                  4      tO ! RH RI]4      tP]P4                  RJ 4       tQ]PF                  P                  RK 4       tS]PF                  P                  RL 4       tT]PF                  P(                  RM 4       tU]PF                  P(                  RN 4       tV]PF                  P(                  ]PF                  PI                  RORPRQ.4      RR 4       4       tWRS tX]PF                  P(                  RT 4       tY]PF                  P(                  RqRU l4       tZ]PF                  P(                  RV 4       t[]PF                  P(                  RW 4       t\]PF                  P(                  RX 4       t]]PF                  P(                  RY 4       t^]PF                  P(                  RZ 4       t_]PF                  P(                  R[ 4       t`]PF                  P(                  R\ 4       taR] tbR^ tcR_ tdR` teRa tfRb tgRc thRd tiRe tjRf tkRg tl]P4                  Rh 4       tm]PF                  Pn                  ]PF                  PI                  RiRjRk.R1Rl7      Rm 4       4       tn]P4                  Rn 4       to]PF                  PI                  RoRjRk.R1Rl7      Rp 4       tpR#   ] d    Rt ELUi ; i  ] d     ELLi ; i)r    )UserListN)changed_environinvoke_script)assert_frame_equalc                   H   a  ] tR t^,t o RtR 3R ltR tR tRR ltRt	V t
R# )	
IpcFixtureNc                 ,    \         P                  ! 4       # NioBytesIO     P/data/cameron/venvs/s3viz/lib/python3.14/site-packages/pyarrow/tests/test_ipc.py<lambda>IpcFixture.<lambda>/   s
    BJJLr   c                <    Wn         V P                  4       V n        R # r
   )_sink_factoryget_sinksink)selfsink_factorys   &&r   __init__IpcFixture.__init__/   s    )MMO	r   c                "    V P                  4       # r
   )r   r   s   &r   r   IpcFixture.get_sink3   s    !!##r   c                6    V P                   P                  4       # r
   )r   getvaluer   s   &r   
get_sourceIpcFixture.get_source6   s    yy!!##r   c                   ^p\         P                  ! R\         P                  ! 4       3R\         P                  ! 4       3.4      pV P	                  V P
                  V4      p. p\        V4       F\  p\         P                  ! \        V4       Uu. uF  p\        P                  ! 4       NK  	  up. RO.VR7      p	VP                  V	4       K^  	  V'       d2   \         P                  P                  V4      p
VP                  V
4       MV F  p	VP                  V	4       K  	  VP                  V n        VP!                  4        V# u upi )   onetwoschema)fooNbarbazbazqux)par'   float64utf8_get_writerr   rangerecord_batchrandomappendTablefrom_batcheswrite_tablewrite_batchstatswrite_statsclose)r   num_batchesas_tablenrowsr'   writerbatchesi_batchtables   &&&        r   write_batchesIpcFixture.write_batches9   s    UBJJL1E27793EFG!!$))V4{#AOO+0<8<a&--/<868E NN5! $ HH))'2Eu% ""5) ! "<< 9s   E
)r   r   r9   )r#   F)__name__
__module____qualname____firstlineno__r9   r   r   r    rD   __static_attributes____classdictcell____classdict__s   @r   r   r   ,   s&     K$8 $$$ r   r   c                   8   a  ] tR t^St o RtRtR tRR ltRtV t	R# )FileFormatFixtureTNc                X    \         P                  P                  WV P                  R 7      # options)r,   ipcnew_filerS   r   r   r'   s   &&&r   r/   FileFormatFixture._get_writerX   s    vvtT\\BBr   c                   V P                  VR 7      p\        P                  ! V P                  4       4      p\        P                  P                  V4      pVP                  \        V4      8X  g   Q h\        V4       Fi  w  rVVP                  V4      pW%,          P                  V4      '       g   Q hVP                  P                  V^ ,          P                  4      '       d   Ki  Q h	  \        VP                  \        P                  P                  4      '       g   Q h\        V P                  \        P                  P                   4      '       g   Q h\#        VP                  4      \#        V P                  4      8X  g   Q hR# )r<   N)rD   r,   BufferReaderr    rT   	open_filenum_record_batcheslen	enumerate	get_batchequalsr'   
isinstancer8   	ReadStatsr9   
WriteStatstuple)r   r<   r?   file_contentsreaderr@   rB   s   &&     r   _check_roundtrip"FileFormatFixture._check_roundtrip[   s   $$h$7(9:!!-0((CL888!'*HA$$Q'E:$$U++++==''
(9(9::::	 + &,,(8(89999$**BFF,=,=>>>>V\\"eD,<,<&====r   r   F)
rF   rG   rH   rI   is_filerS   r/   rg   rJ   rK   rL   s   @r   rO   rO   S   s     GGC> >r   rO   c                   2   a  ] tR t^nt o RtRtRtR tRtV t	R# )StreamFormatFixtureFNc                Z    \         P                  P                  VVV P                  R 7      # rQ   )r,   rT   
new_streamrS   rV   s   &&&r   r/   StreamFormatFixture._get_writerv   s+    vv  LL ! 
 	
r   r   )
rF   rG   rH   rI   use_legacy_ipc_formatrS   rj   r/   rJ   rK   rL   s   @r   rl   rl   n   s!      "GG
 
r   rl   c                   &   a  ] tR t^~t o R tRtV tR# )MessageFixturec                .    \         P                  ! W4      # r
   r,   RecordBatchStreamWriterrV   s   &&&r   r/   MessageFixture._get_writer       ))$77r   r   N)rF   rG   rH   rI   r/   rJ   rK   rL   s   @r   rr   rr   ~   s     8 8r   rr   c                      \        4       # r
   )r   r   r   r   ipc_fixturery      s
    <r   c                      \        4       # r
   )rO   r   r   r   file_fixturer{      s    r   c                      \        4       # r
   )rl   r   r   r   stream_fixturer}            r   r{   zFile Format)idr}   zStream Format)paramsc                 8    V P                  V P                  4      # r
   )getfixturevalueparamrequests   &r   format_fixturer      s     ""7==11r   c                     R p \         P                  ! \        P                  4      ;_uu_ 4        \        P                  P                  \        P                  ! V 4      4       RRR4       R#   + '       g   i     R# ; ir   N)pytestraisesr,   ArrowInvalidrT   r[   rZ   bufs    r   test_empty_filer      sD    
C	r	'	'
-. 
(	'	'	's   4A--A>	c                 *    V P                  R R7       R# )FrY   Nrg   r{   s   &r   test_file_simple_roundtripr      s    !!5!1r   c                 *    V P                  R R7       R# )TrY   Nr   r   s   &r   test_file_write_tabler      s    !!4!0r   r   c                  ,    \         P                  ! 4       # r
   r   r   r   r   r   r      s
    BJJLr   c                  ,    \         P                  ! 4       # r
   )r,   BufferOutputStreamr   r   r   r   r      s    B!!#r   c                 R   \        V 4      pVP                  4       p\        P                  ! VP	                  4       4      p\        P
                  P                  V4      pVP                  4       p\        P                  P                  V4      pVP                  V4      '       g   Q hR # r
   )rO   rD   r,   rZ   r    rT   r[   read_allr4   r5   r`   )r   fixturer?   re   rf   resultexpecteds   &      r   test_file_read_allr      s|    
  -G##%GOOG$6$6$89MVVm,F__Fxx$$W-H==""""r   c                    V P                  4        V P                  4       p\        P                  P	                  V4      p\        P                  P	                  \        P
                  ! V4      4      p\        P                  ! V4      pVP                  4       pVP                  4       pVP                  4       pVP                  V4      '       g   Q hVP                  V4      '       g   Q hVP                  pVP                  ^8X  g   Q hVP                  ^8X  g   Q hVP                  V8X  g   Q hVP                  V8X  g   Q hR#    N)rD   r    r,   rT   r[   rZ   RecordBatchFileReaderr   r`   r8   num_messagesr\   )	r{   sourcereader1reader2reader3result1result2result3st1s	   &        r   test_open_file_from_bufferr      s    $$&Fffv&Gffrv67G&&v.G G G G>>'"""">>'""""
--Cq   !!Q&&&==C==Cr   c                 p   V P                  4        Uu. uF  qP                  4       NK  	  pp\        P                  ! V P	                  4       4      p\        P
                  P                  V4      pVP                  4       p\        P                  ! V4      P                  R R7      p\        WV4       R# u upi T)dropN)rD   	to_pandasr,   rZ   r    rT   r[   read_pandaspdconcatreset_indexr   )r{   rB   framesre   rf   r   r   s   &      r   test_file_read_pandasr      s    -9-G-G-IJ-IEoo-IFJOOL$;$;$=>MVVm,F!Fyy ,,$,7Hv( Ks   B3c                 4   V P                  4        V P                  4       pVP                  R 4      P                  p\	        VR4      ;_uu_ 4       pVP                  V4       RRR4       \        P                  P                  \        P                  ! V4      4      P                  4       p\        P                  P                  \        P                  ! V4      4      P                  4       pVP                  V4      '       g   Q hR#   + '       g   i     L; i)
file.arrowwbN)rD   r    joinstrpathopenwriter,   rT   r[   pathlibPathr   OSFiler`   )r{   tmpdirr   pathft1t2s   &&     r   test_file_pathlibr      s     $$&F;;|$,,D	dD		Q	 
 
		',,t,	-	6	6	8B			"))D/	*	3	3	5B99R=== 
	s   DD	c                     \         P                  ! R 4      p \        P                  ! \        P
                  4      ;_uu_ 4        \        P                  P                  V 4       RRR4       R#   + '       g   i     R# ; ir   )r   r   r   r   r,   r   rT   open_streamr   s    r   test_empty_streamr      sC    
**S/C	r	'	'
3 
(	'	'	's    A--A>	c           	     V   \         P                  ! 4       p\         P                  ! \         P                  ! RV4      .4      pV P	                  R4      P
                  p\         P                  ! VR4      ;_uu_ 4       p\         P                  P                  WB4      ;_uu_ 4       p\         P                  ! R.VR7      p\         P                  ! V.V4      pVP                  V4       RRR4       RRR4       \        RV4       R#   + '       g   i     L&; i  + '       g   i     L1; i)zARROW-15783: Verify to_pandas works for interval types.

Interval types require static structures to be enabled. This test verifies
that they are when no other library functions are invoked.
numsr   r   typeNzread_record_batch.py         )r,   month_day_nano_intervalr'   fieldr   r   r   rT   rU   arrayr1   r   r   )r   mdn_interval_typer'   r   r   r>   interval_arrayrB   s   &       r   "test_read_year_month_nano_intervalr      s     224YY):;<=F;;|$,,D	4		$VV__T**fXXyk8IJNOO^$4f=ELL + 

 ($/	 +* 
	s%   <(D$AD	'DDDD(	c                    \         P                  ! R \        P                  P	                  ^4      R\         P
                  ! R\        P                  RRR.RR.RR7      /4      p\        P                  P                  V4      pV P                  V P                  VP                  4      ;_uu_ 4       pVP                  V4       RRR4       \        P                  P                  \        P                   ! V P#                  4       4      4      P%                  4       p\'        VP)                  4       V4       R#   + '       g   i     L{; i)r$   r%   r(   r)   T
categoriesorderedN)r   	DataFramenpr2   randnCategoricalnanr,   RecordBatchfrom_pandasr/   r   r'   r7   rT   r   rZ   r    r   r   r   )r}   dfrB   wrrC   s   &    r   !test_stream_categorical_roundtripr     s    	ryyq!r~~ubffeUEB*/&*, 
B NN&&r*E		#	#N$7$7	F	F"
u 
G VV0I0I0K LMhj 
u("- 
G	Fs   1D66E	c                    V P                  4        V P                  4       p\        P                  P	                  V4      p\        P                  P	                  \        P
                  ! V4      4      p\        P                  ! V4      pVP                  4       pVP                  4       pVP                  4       pVP                  V4      '       g   Q hVP                  V4      '       g   Q hVP                  pVP                  ^8X  g   Q hVP                  ^8X  g   Q hVP                  V8X  g   Q hVP                  V8X  g   Q h\        V4      \        V P                  4      8X  g   Q hR# r   )rD   r    r,   rT   r   rZ   RecordBatchStreamReaderr   r`   r8   r   r\   rd   r9   )	r}   r   r   r   r   r   r   r   r   s	   &        r   test_open_stream_from_bufferr     s#     "&&(Fff  (Gff  !89G((0G G G G>>'"""">>'""""
--Cq   !!Q&&&==C==C:~99::::r   rS   Fuse_threadsc                 T   V P                  4        V P                  4       p\        P                  P	                  W!R 7      pVP                  4        VP                  pVP                  ^8X  g   Q hVP                  ^8X  g   Q h\        V4      \        V P                  4      8X  g   Q hR# rR   N)rD   r    r,   rT   r   r   r8   r   r\   rd   r9   )r}   rS   r   rf   sts   &&   r   test_open_stream_optionsr   5  s    
   "&&(FVV8F
OO	B??a  A%%%9n889999r   c                    V P                  4        V P                  4       p\        P                  ! \        4      ;_uu_ 4        \
        P                  P                  VR R7       RRR4       R#   + '       g   i     R# ; iTrR   N)rD   r    r   r   	TypeErrorr,   rT   r   )r}   r   s   & r   #test_open_stream_with_wrong_optionsr   G  sQ      "&&(F	y	!	!
640 
"	!	!	!   "A//B 	c                 
   V P                  4        V P                  4       p\        P                  P	                  W!R 7      pVP                  4        VP                  pVP                  ^8X  g   Q hVP                  ^8X  g   Q hR# r   )	rD   r    r,   rT   r[   r   r8   r   r\   )r{   rS   r   rf   r   s   &&   r   test_open_file_optionsr   O  sn    
  $$&FVVf6F
OO	B??a  A%%%r   c                    V P                  4        V P                  4       p\        P                  ! \        4      ;_uu_ 4        \
        P                  P                  VR R7       RRR4       R#   + '       g   i     R# ; ir   )rD   r    r   r   r   r,   rT   r[   )r{   r   s   & r   !test_open_file_with_wrong_optionsr   `  sQ     $$&F	y	!	!
. 
"	!	!	!r   c                 (   \         P                  ! R \        P                  P	                  ^4      R\         P
                  ! R\        P                  RRR.RR.RR7      /4      p\        P                  P                  VRR7      p\        P                  P                  VRR7      pV P                  V P                  VP                  4      ;_uu_ 4       pVP                  V4       VP                  V4       RRR4       \        P                  P!                  \        P"                  ! V P%                  4       4      4      P'                  4       p\)        VP+                  4       \         P,                  ! W.RR	7      4       R#   + '       g   i     L; i)
r$   r%   r(   r)   Tr   Fpreserve_indexNignore_index)r   r   r   r2   r   r   r   r,   r4   r   r   r/   r   r'   r   rT   r   rZ   r    r   r   r   r   )r}   r   rC   rB   r   s   &    r   test_stream_write_dispatchr   h  s    
ryyq!r~~ubffeUEB*/&*, 
B HH  E :ENN&&r%&@E		#	#N$7$7	F	F"

 
G VV0I0I0K LMhj 
u(yy"=? 
G	Fs   #FF	c           	      l   \         P                  ! R \        P                  P	                  ^4      /4      p\
        P                  P                  VR,          RR7      p\
        P                  P                  VRR7      p\
        P                  P                  W#V.4      pV P                  V P                  VP                  4      ;_uu_ 4       pVP                  V^R7       RRR4       \        \
        P                  P!                  V P#                  4       4      4      p\        \%        \&        V4      4      . RO8X  g   Q h\
        P                  P                  V4      p\)        VP+                  4       \         P,                  ! VR,          WR,          .RR7      4       R#   + '       g   i     L; i)	r$   :N
   NFr   )max_chunksizeNTr   )r      r#   r   )r   r   r   r2   r   r,   r   r   r4   r5   r/   r   r'   r6   listrT   r   r    mapr]   r   r   r   )r}   r   b1b2rC   r   r?   result_tables   &       r   test_stream_write_table_batchesr  }  s;    
ryyr" 
B 
	#	#BsGE	#	BB		#	#Bu	#	=BHH!!22,/E		#	#N$7$7	F	F"
uB/ 
G 266%%n&?&?&ABCGC!"o55588((1L|--/yy"S'2#w!7.245 
G	Fs   F##F3	c                 R   V P                  4       p\        P                  ! V P                  4       4      p\        P                  P                  V4      pVP                  P                  V^ ,          P                  4      '       g   Q h^ p\        V4       F-  w  rVVP                  W,          4      '       g   Q hV^,          pK/  	  V\        V4      8X  g   Q h\        P                  ! \        4      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     R# ; ir   N)rD   r,   rZ   r    rT   r   r'   r`   r^   r]   r   r   StopIterationread_next_batch)r}   r?   re   rf   totalr@   
next_batchs   &      r   test_stream_simple_roundtripr    s    **,GOON$=$=$?@MVV.F==
 1 12222E"6*  ,,,,
 + CL   	}	%	%  
&	%	%	%s   :DD&	c                  r   \         P                  ! 4       p \        R 4       Uu. uF  p\        P                  ! ^ ^4      NK  	  pp\
        P                  P                  V.R.R7      p\
        P                  P                  RR7      p\
        P                  P                  WP                  VR7      ;_uu_ 4       pVP                  V4       RRR4       \        V P                  4       4      p\         P                  ! 4       p\
        P                  ! R^R7      p\
        P                  P                  VR7      p\
        P                  P                  WsP                  VR7      ;_uu_ 4       pVP                  V4       RRR4       \        VP                  4       4      p	W8w  g   Q h\
        P                  P!                  V 4      P#                  4       p
\
        P                  P!                  V4      P#                  4       pW8X  g   Q hR# u upi   + '       g   i     ELN; i  + '       g   i     L; i)i'  valuesnameszstdcompressionrR   N)compression_level)r   r   r0   r2   randintr,   r4   from_arraysrT   IpcWriteOptionsRecordBatchFileWriterr'   r6   r]   r   Codecr[   r   )r   rA   r  rC   rS   r>   len1sink2codeclen2r   r   s               r   test_compression_roundtripr    s   ::<D,1%L9LqfnnQ"LF9HH  &( <Eff$$$8G		%	%,, 
& 
1 
14:5!
1 t}}DJJLEHHVq1Eff$$$7G		%	%<< 
& 
2 
25;5!
2 u~~ D
 <<			$		(	(	*B			%	 	)	)	+B8O83 :
1 
1 
1
2 
2s    H;H.H&H#	&H6	c                     \         P                  P                  4       p V P                  R J g   Q hV P                  R J g   Q hV P
                  \         P                  P                  P                  8X  g   Q hRV n        V P                  RJ g   Q hRV n        V P                  RJ g   Q h\         P                  P                  P                  V n        V P
                  \         P                  P                  P                  8X  g   Q hR F:  p\        P                  ! \        \        34      ;_uu_ 4        Wn        RRR4       K<  	  V P                  e   Q hR Fk  p\         P                  P                  V4      '       g   K*  Wn        V P                  V8X  g   Q hVP!                  4       V n        V P                  V8X  d   Kk  Q h	  RV n        V P                  e   Q h\        P                  ! \        4      ;_uu_ 4        ^ V n        RRR4       V P"                  RJ g   Q hR V n        V P"                  R J g   Q h\         P                  P                  R4      '       d   \         P                  P                  \         P                  P                  P                  RRRR R7      p V P
                  \         P                  P                  P                  8X  g   Q hV P                  RJ g   Q hV P                  RJ g   Q hV P                  R8X  g   Q hV P"                  R J g   Q hR# R#   + '       g   i     EK2  ; i  + '       g   i     EL>; i)FTNlz4)metadata_versionallow_64bituse_legacy_formatr  r   )V5*   )r!  r  )r,   rT   r  r#  r$  r"  MetadataVersionr%  V4r   r   r   
ValueErrorr  r  is_availableupperr   )rS   values     r   test_write_optionsr-    s   ff$$&G%'''$$---##rvv'='='@'@@@@G$&&& $G$$,,,!vv5588G##rvv'='='@'@@@@]]Iz233',$ 43  &&& 88  ''"'&&%///"'++-G&&%/// ! G&&&	y	!	! 
" $&&&G%'''	xxU##&&((VV3366" )  ''266+A+A+D+DDDD""d***((D000""e+++""e+++ $) 433 
"	!	!s   5L*L?*L<?M	T)r#  )r$  )r"  )r$  r"  c                    Wn         V P                  4       p\        P                  ! V P	                  4       4      p\        P
                  P                  V P	                  4       4      pVP                  VP                  8X  g   Q h\        P
                  P                  V4      pVP                  P                  V^ ,          P                  4      '       g   Q h^ p\        V4       F-  w  rxVP                  W',          4      '       g   Q hV^,          pK/  	  V\        V4      8X  g   Q h\        P                  ! \        4      ;_uu_ 4        VP!                  4        RRR4       R#   + '       g   i     R# ; ir  )rS   rD   r,   rZ   r    rT   read_messager"  r   r'   r`   r^   r]   r   r   r	  r
  )	r}   rS   r?   re   messagerf   r  r@   r  s	   &&       r   test_stream_options_roundtripr1    s    %**,GOON$=$=$?@Mff!!.";";"=>G##w'?'????VV.F==
 1 12222E"6*  ,,,,
 + CL   	}	%	%  
&	%	%	%s   
E%%E6	c                  "   \         P                  P                  4       p V P                  R J g   Q hV P                  R J g   Q hV P
                  \         P                  P                  P                  8X  g   Q hV P                  . 8X  g   Q hRV n        V P                  RJ g   Q h\         P                  P                  P                  V n        V P
                  \         P                  P                  P                  8X  g   Q h\         P                  P                  P                  V n        V P
                  \         P                  P                  P                  8X  g   Q hRV n        V P                  RJ g   Q h^ ^.V n        V P                  ^ ^.8X  g   Q h\        P                  ! \        4      ;_uu_ 4        RV n        RRR4       \         P                  P                  RR\         P                  P                  P                  ^.R7      p V P                  RJ g   Q hV P                  RJ g   Q hV P
                  \         P                  P                  P                  8X  g   Q hV P                  ^.8X  g   Q hR#   + '       g   i     L; i)TFN)r   ensure_native_endianensure_alignmentincluded_fields)r,   rT   IpcReadOptionsr   r3  r4  	AlignmentAnyr5  DataTypeSpecificAt64Byter   r   r   rR   s    r   test_read_optionsr;    s   ff##%G$&&&''4///##rvv'7'7';';;;;""b(((#(G ''5000!vv//@@G##rvv'7'7'H'HHHH!vv//88G##rvv'7'7'@'@@@@G%''' !fG""q!f,,,	y	!	!"& 
" ff##))::QC $ G %'''''5000##rvv'7'7'H'HHHH""qc))) 
"	!s   9I>>J	c                    \         P                  P                  4       p\         P                  P                  ^.R7      p\         P                  P	                  \         P
                  ! . RO4      \         P
                  ! . R	O4      .RR.R7      pV P                  V P                  VP                  4      ;_uu_ 4       pVP                  V4       RRR4       V P                  4       p\         P                  P                  WQR7      p\         P                  P                  WR\         P                  ! 4       R7      pVP                  4       pVP                  4       p	VP                  ^8X  g   Q hV	P                  ^8X  g   Q h\         P                  P	                  \         P
                  ! . R	O4      .R.R7      p
W8X  g   Q hW8X  g   Q hR#   + '       g   i     EL; i)
r   )r5  abr  NrR   )rS   memory_poolr(   r)   bazr+   r   r   r      )r,   rT   r6  r4   r  r   r/   r   r'   r6   r    r   system_memory_poolr   num_columns)r}   options1options2rC   r   r   r   r   r   r   r   s   &          r   !test_read_options_included_fieldsrH  8  s|   vv$$&Hvv$$aS$9HHH  "((+G"H!#,!7"9(+Sz ! 3E 
	#	#N$7$7	F	F"
u 
G&&(Fff   :Gff  b.C.C.E ! GG  G G!###!###xx##RXXl%;$<SE#JH! 
G	F	Fs   ?GG	c           
        a a \         P                  ! \         P                  ! 4       \         P                  ! 4       4      p. RO. ROR R.. RORR..pV Uu. uF;  p\         P                  P                  \         P                  ! W1R7      .R.R7      NK=  	  ppVR,          pV^ ,          P                  oRV V3R llpS P                  '       d|   \        P                  ! \         P                  4      ;_uu_ 4        V! V4       RRR4       \        P                  ! \         P                  4      ;_uu_ 4        V! V4       RRR4       MTV! V4      pVP                  ^8X  g   Q hVP                  ^8X  g   Q hVP                  ^8X  g   Q hVP                  ^ 8X  g   Q hRS n        \         P"                  P%                  R	R
7      S n        S P                  '       d?   \        P                  ! \         P                  4      ;_uu_ 4        V! V4       RRR4       MTV! V4      pVP                  ^8X  g   Q hVP                  ^8X  g   Q hVP                  ^8X  g   Q hVP                  ^8X  g   Q hV! V4      pVP                  ^8X  g   Q hVP                  ^8X  g   Q hVP                  ^ 8X  g   Q hVP                  ^8X  g   Q h\         P"                  P%                  R	R7      S n        V! VR	R7      pVP                  ^8X  g   Q hS P                  '       d<   VP                  ^8X  g   Q hVP                  ^ 8X  g   Q hVP                  ^ 8X  g   Q hR# VP                  ^8X  g   Q hVP                  ^8X  g   Q hVP                  ^ 8X  g   Q hR# u upi   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL\; i)r(   Nr)   quuxr   dictsr  :NrC  Nc                 Z  < SP                  \        P                  ! 4       S4      ;_uu_ 4       pV'       d2   \        P                  P	                  V 4      pVP                  V4       MV  F  pVP                  V4       K  	  VP                  uuR R R 4       #   + '       g   i     R # ; ir
   )r/   r,   MockOutputStreamr4   r5   r6   r7   r8   )r?   r<   r>   rC   rB   r   r'   s   &&   r   rD   ,test_dictionary_delta.<locals>.write_batches_  s    ''(;(;(=(.0 039--g6""5)$E&&u- %<<0 0 0 0s   ABB*	T)emit_dictionary_deltas)unify_dictionariesrY   )r(   r(   N)r(   r)   r(   )r(   Nr)   rJ  ri   )r,   
dictionaryint8r.   r   r  r   r'   rj   r   r   r   r\   num_dictionary_batchesnum_replaced_dictionariesnum_dictionary_deltasrp   rT   r  rS   )	r   tydatavr?   batches_delta_onlyrD   r   r'   s	   f       @r   test_dictionary_deltarZ  Q  sR   	rwwy"'')	,B !EN(FO	D A 	""BHHQ$8#9'"K   !QZF	  	  ]]2??++'" , ]]2??++,- ,+ 7#$$)))((A---++q000''1,,,+/N(VV33# 4 %N]]2??++'" ,+ 7#$$)))((A---++q000''1,,,	)	*B  A%%%$$)))''1,,,##q(((VV33 4 N 
w	.B  A%%%((A---++q000''1,,,((A---++q000''1,,,A& ,++ ,++ ,++s+   AN;	N8	N%	N9N"	%N6	9O
	c            	      	   \         P                  ! \         P                  ! R \         P                  ! 4       4      .4      p \         P                  P                  \         P                  ! 4       V 4      pVP                  '       d   Q hVP                  \         P                  P                  P                  8X  g   Q h\         P                  P                  \         P                  ! 4       V 4      pVP                  '       d   Q hVP                  \         P                  P                  P                  8X  g   Q h\        RR4      ;_uu_ 4        \         P                  P                  \         P                  ! 4       V 4      pVP                  '       g   Q hVP                  \         P                  P                  P                  8X  g   Q h\         P                  P                  \         P                  ! 4       V 4      pVP                  '       g   Q hVP                  \         P                  P                  P                  8X  g   Q h RRR4       \        RR4      ;_uu_ 4        \         P                  P                  \         P                  ! 4       V 4      pVP                  '       d   Q hVP                  \         P                  P                  P                  8X  g   Q h\         P                  P                  \         P                  ! 4       V 4      pVP                  '       d   Q hVP                  \         P                  P                  P                  8X  g   Q h RRR4       \        RR4      ;_uu_ 4        \        RR4      ;_uu_ 4        \         P                  P                  \         P                  ! 4       V 4      pVP                  '       g   Q hVP                  \         P                  P                  P                  8X  g   Q h\         P                  P                  \         P                  ! 4       V 4      pVP                  '       g   Q hVP                  \         P                  P                  P                  8X  g   Q h RRR4       RRR4       R#   + '       g   i     EL\; i  + '       g   i     ELZ; i  + '       g   i     LB; i  + '       g   i     R# ; i)r(   ARROW_PRE_0_15_IPC_FORMAT1NARROW_PRE_1_0_METADATA_VERSION)r,   r'   r   int32rT   rn   r   _use_legacy_format_metadata_versionr'  r%  rU   r   r(  )r'   r>   s     r   !test_envvar_set_legacy_ipc_formatrb    sH   YY
345FVVr446?F(((((##rvv'='='@'@@@@VV__R224f=F(((((##rvv'='='@'@@@@	4c	:	:""2#8#8#:FC(((((''266+A+A+D+DDDD!6!6!8&A(((((''266+A+A+D+DDDD 
; 
93	?	?""2#8#8#:FC,,,,,''266+A+A+D+DDDD!6!6!8&A,,,,,''266+A+A+D+DDDD 
@ 
93	?	?8#>>VV&&r'<'<'>GF,,,,,++rvv/E/E/H/HHHHVV__R%:%:%<fEF,,,,,++rvv/E/E/H/HHHH ? 
@	?! 
;	:	: 
@	?	? ?> 
@	?	?sQ   CR7R"CR-$7R-8SCS	7S	SR*	-R>	SSS%	c                 <   V P                  4       p\        P                  ! V P                  4       4      p\        P                  P                  V4      pVP                  4       p\        P                  P                  V4      pVP                  V4      '       g   Q hR # r
   )
rD   r,   rZ   r    rT   r   r   r4   r5   r`   )r}   r?   re   rf   r   r   s   &     r   test_stream_read_allrd    sp    **,GOON$=$=$?@MVV.F__Fxx$$W-H==""""r   c                 H   V P                  4        Uu. uF  qP                  4       NK  	  ppV P                  4       p\        P                  P                  V4      pVP                  4       p\        P                  ! V4      P                  R R7      p\        WV4       R# u upi r   )rD   r   r    r,   rT   r   r   r   r   r   r   )r}   rB   r   re   rf   r   r   s   &      r   test_stream_read_pandasrf    s    -;-I-I-KL-KEoo-KFL"--/MVV.F!Fyy ,,$,7Hv( Ms   Bc                     V P                  4       pV P                  4       p\        P                  ! V4      p\        P                  P                  V4      pV\        V4      3# r
   )rD   r    r,   rZ   MessageReaderr   r  )r}   r?   re   
buf_readerrf   s   &    r   example_messagesrj    sQ    **,G"--/M/J))*5FDL  r   c                  x   \         P                  ! \        4      ;_uu_ 4        \        \        P
                  ! 4       4       R R R 4       \         P                  ! \        4      ;_uu_ 4        \        \        P                  ! 4       4       R R R 4       R #   + '       g   i     L[; i  + '       g   i     R # ; ir
   )r   r   r   reprr,   Messagerh  r   r   r   test_message_ctors_no_segfaultrn    sc    	y	!	!RZZ\ 
" 
y	!	!R  
"	! 
"	! 
"	!	!s   B,B(B%	(B9	c                    V w  r\        V4      ^8X  g   Q hV^ ,          P                  R8X  g   Q h\        V^ ,          P                  \        P
                  4      '       g   Q h\        V^ ,          P                  \        P
                  4      '       g   Q hV^ ,          P                  \        P                  P                  8X  g   Q hVR,           F  pVP                  R8X  g   Q h\        VP                  \        P
                  4      '       g   Q h\        VP                  \        P
                  4      '       g   Q hVP                  \        P                  P                  8X  d   K  Q h	  R# )r   r'   r   NNzrecord batchN)
r]   r   ra   metadatar,   Bufferbodyr"  r'  r%  )rj  rA   messagesmsgs   &   r   test_message_readerrv    s   "KAx=AA;x'''hqk**BII6666hqk&&		2222A;''2+=+=+@+@@@@||xx>)))#,,		2222#((BII....##r'9'9'<'<<<<	 r   c                 (   V w  rV^ ,          pVP                  4       p\        P                  ! VP                  4       ^,          4      p\        P                  P                  V4      p\        P                  P                  V4      p\        P                  P                  VP                  4       4      p\        P                  P                  V4      p	VP                  V4      '       g   Q hVP                  V4      '       g   Q hVP                  V4      '       g   Q hVP                  V	4      '       g   Q h\        P                  ! \        P                  RR7      ;_uu_ 4        \        P                  P                  \        P                  ! R4      4       RRR4       \        P                  ! \        4      ;_uu_ 4        \        P                  P                  V4       RRR4       R#   + '       g   i     L\; i  + '       g   i     R# ; i)r   zCorrupted messagematchs   abN)	serializer,   rZ   
to_pybytesrT   r/  r`   r   r   r   EOFError)
rj  rA   rt  ru  r   rf   restored	restored2	restored3	restored4s
   &         r   #test_message_serialize_read_messager    sZ   "KA
1+C
--/C__S^^-12Fvv""3'H##F+I##CNN$45I##F+I::h::i    ::i    ::i    	r.A	B	B
BOOE23 
C 
x	 	 
F# 
!	  
C	B 
!	 	 s   %4G- H -G=	 H	c                     V w  rV F?  p\        V4      pR V9  g   Q hRV9  g   Q hRV9  g   Q hRVP                   2V9   d   K?  Q h	  R# )z{self.type}z{metadata_len}z
{body_len}ztype: N)strr   )rj  rA   rt  ru  ss   &    r   %test_message_repr_shows_actual_valuesr    s_    "KAHA%%%q(((1$$$z"a''' r   c                    V w  rV F  p\         P                  ! 4       p\         P                  ! VR R7      ;_uu_ 4       pVP                  V4       RRR4       VP	                  4       p\         P
                  P                  \         P                  ! VR R7      4      pVP                  V4      '       d   K  Q h	  R#   + '       g   i     Lt; i)gzipr  N)	r,   r   output_streamserialize_tor   rT   r/  input_streamr`   )rj  rA   rt  r0  raw_outcompressed_outcompressed_bufr   s   &       r   !test_message_read_from_compressedr    s     #KA'')g6::n  0 ; !))+$$R__^AG&I J}}W%%%% ::s   B==Cc                     V w  r\         P                  P                  V^ ,          4      pVP                  V^,          P                  4      '       g   Q hR# r  )r,   rT   read_schemar`   r'   )rj  r?   rt  r'   s   &   r   test_message_read_schemar  *  sA    (GVV,F==**++++r   c                     V w  r\        WR ,          4       FG  w  r4\        P                  P                  WCP                  4      pVP                  V4      '       d   KG  Q h	  R# )rp  N)zipr,   rT   read_record_batchr'   r`   )rj  r?   rt  rB   r0  
read_batchs   &     r   test_message_read_record_batchr  0  sN    (Gg|4VV--g||D
  '''' 5r   c                  h   \         P                  ! \         P                  ! R .\         P                  ! 4       R7      .R.R7      p \         P                  ! 4       p\         P
                  P                  WP                  4      ;_uu_ 4       pVP                  V 4       RRR4       VP                  4       p\        P                  ! \        RR7      ;_uu_ 4        \         P
                  P                  W0P                  4       RRR4       R#   + '       g   i     Lx; i  + '       g   i     R# ; i)   foor   strsr  Nz type record batch but got schemarx  )r,   r1   r   r.   r   rT   rn   r'   r7   r   r   r   IOErrorr  )rB   streamr>   r   s       r   .test_read_record_batch_on_stream_error_messager  8  s    OORXXvhRWWY?@#)(,E""$F			6<<	0	0F5! 
1
//
C	w?
A 
A
  ll3
A 
A 
1	0
A 
A 
As   D*D D	 D1	c                   2   a  ] tR tRt o R tR tR tRtV tR# )StreamReaderServeriI  c                P   \         P                   ! \         P                  \         P                  4      V n        V P                  P	                  R4       V P                  P                  ^4       V P                  P                  4       w  r#Wn        RV n        . V n	        RV n
        V# )	127.0.0.1N)r  r   )socketAF_INETSOCK_STREAM_sockbindlistengetsockname_do_read_all_schema_batches_table)r   do_read_allhostports   &&  r   initStreamReaderServer.initK  su    ]]6>>63E3EF


()

!ZZ++-
'r   c                $   V P                   P                  4       w  r VP                  R R7      p\        P                  P                  V4      pVP                  V n        V P                  '       d   VP                  4       V n
        M/\        V4       F   w  rVV P                  P                  V4       K"  	  VP                  4        V P                   P                  4        R#   TP                  4        T P                   P                  4        i ; i)rbmodeN)r  acceptmakefiler,   rT   r   r'   r  r  r   r  r^   r  r3   r:   )r   
connectionclient_addressr   rf   r@   rB   s   &      r   runStreamReaderServer.runV  s    %)ZZ%6%6%8"
	((d(3FVV''/F!==DL   $oo/ )& 1HAMM((/ !2 JJ JJs   BC# #,Dc                p    V P                   V P                  '       d   V P                  3# V P                  3# r
   )r  r  r  r  r   s   &r   
get_resultStreamReaderServer.get_resulte  s5    T->->->dkk $ 	$]]$ 	$r   )r  r  r  r  r  N)	rF   rG   rH   rI   r  r  r  rJ   rK   rL   s   @r   r  r  I  s     	$ $r   r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	SocketStreamFixtureij  c                    R # r
   r   r   s   &r   r   SocketStreamFixture.__init__l  s     	r   c                b   \        4       V n        V P                  P                  V4      pV P                  P                  4        \        P                  ! \        P
                  \        P                  4      V n        V P                  P                  R V34       V P                  4       V n
        R# )r  N)r  _serverr  startr  r  r  r  connectr   r   )r   r  r  s   && r   start_server SocketStreamFixture.start_serverq  sp    )+||  -]]6>>63E3EF


K./MMO	r   c                0   ^ RI pV P                  P                  VP                  R^ 4      4       V P                  P	                  4        V P
                  P                  4        V P                  P                  4        V P                  P                  4       # )r   NQ)
structr   r   packflushr  r:   r  r   r  )r   r  s   & r   stop_and_get_result'SocketStreamFixture.stop_and_get_resulty  sa    		C+,		

||&&((r   c                :    V P                   P                  R R7      # )r   r  )r  r  r   s   &r   r   SocketStreamFixture.get_sink  s    zz"""--r   c                .    \         P                  ! W4      # r
   rt   rV   s   &&&r   r/   SocketStreamFixture._get_writer  rw   r   )r  r  r   N)rF   rG   rH   rI   r   r  r  r   r/   rJ   rK   rL   s   @r   r  r  j  s#     
$).8 8r   r  c                      \        4       # r
   )r  r   r   r   socket_fixturer    r~   r   c                 ^   V P                  R R7       V P                  4       pV P                  4       w  r#VP                  V^ ,          P                  4      '       g   Q h\        V4      \        V4      8X  g   Q h\        V4       F$  w  rEW4,          P                  V4      '       d   K$  Q h	  R# )Fr  N)r  rD   r  r`   r'   r]   r^   )r  writer_batchesreader_schemareader_batchesr@   rB   s   &     r   test_socket_simple_roundtripr    s    E2#113N$2$F$F$H!Mq 1 8 89999~#n"5555n- ''.... .r   c                     V P                  R R7       V P                  4       pV P                  4       w  r#\        P                  P                  V4      pVP                  V4      '       g   Q hR# )Tr  N)r  rD   r  r,   r4   r5   r`   )r  r  rA   r   r   s   &    r   test_socket_read_allr    sZ    D1#113N224IAxx$$^4H==""""r   c                  X   \         P                  ! R R./4      p \        P                  P	                  V 4      p\        P
                  ! 4       p\        W4       VP                  4       p\        P                  P                  VR,          4      pVP                  4       p\        W4       R# )r(         ?:   NNN)r   r   r,   r   r   r   
write_filer   rT   r   r   r   )r   rB   r   bufferrf   rdfs         r   test_ipc_file_stream_has_eosr    s     
usen	%BNN&&r*E  "Du]]_F VVr
+F 


Crr   c                     \         P                  ! R R./4      p \        P                  P	                  V 4      p\        P
                  ! 4       p\        W4       VP                  4       p\        P                  ! V4      p\        V4      pV^ ,          P                  4       p\         P                  ! V4      p\        W4       R# )r(   r  N)r   r   r,   r   r   r   r  r   rZ   	read_filer   r   )r   rB   r   r  rf   r?   rW  r  s           r   test_ipc_zero_copy_numpyr    s    	usen	%BNN&&r*E  "Du]]_F__V$FG1:!D
,,t
Crr   ipc_typer  filec           
      z   \         P                  ! R R./4      p\        P                  P	                  V4      p\        P
                  ! 4       p^pR\        P                  P                  R\        P                  P                  /V ,          pV! W2P                  4      ;_uu_ 4       p\        V4       F!  pVP                  VR\        V4      /R7       K#  	  VP                  V4       RRR4       VP                  4       pV R8X  dK   \        P                  P                  V4      ;_uu_ 4       p	\        V	P!                  4       4      p
RRR4       Mc\        P                  P#                  V4      ;_uu_ 4       p	\        V	P$                  4       Uu. uF  pV	P'                  V4      NK  	  p
pRRR4       \        V4       F}  pX
V,          P(                  P*                  ^8X  g   Q h\-        W,          P.                  \        P0                  4      '       g   Q hW,          P.                  R\        V4      /8X  d   K}  Q h	  X
V,          P(                  P*                  ^8X  g   Q hW,          P.                  e   Q hR#   + '       g   i     EL; i  + '       g   i     L; iu upi   + '       g   i     EL; i)r(   r  r  r  batch_id)custom_metadataN)r   r   r,   r   r   r   rT   rn   rU   r'   r0   r7   r  r   r   r  !iter_batches_with_custom_metadatar[   r\   get_batch_with_custom_metadatarB   num_rowsra   r  KeyValueMetadata)r  r   rB   r   batch_countfile_factoryr>   r@   r  rf   batch_with_metass   &          r   +test_batches_with_custom_metadata_roundtripr    s6    
usen	%BNN&&r*E  "DKbff//BFFOO--57L 
dLL	)	)V{#Auz3q66JK $ 	5!	 
* ]]_F8VV''6#F$L$L$NO (' VVf%%).v/H/H)I K)IA !' E Ea H)I   K & ;"((11Q666//1D1DF F 	F F"22z3q66JJJJ	   K(..771<<<(88@@@1 
*	)	) (' K &%%s7   'AI=/J9J)J$+J)=J	J!	$J))J:	c                     \         P                  P                  \         P                  ! . RO4      \         P                  ! . RO4      .RR.R7      p \         P                  ! 4       p\         P
                  P                  WP                  4      ;_uu_ 4         RRR4       VP                  4       p\         P
                  P                  V4      ;_uu_ 4       pVP                  4       pRRR4       XP                  P                  V P                  4      '       g   Q h\        V4      ^ 8X  g   Q hR#   + '       g   i     L; i  + '       g   i     Ld; i)r   r=  r>  r  NrB  r@  )r,   r4   r  r   r   rT   rn   r'   r   r   r   r`   r]   )rC   r   r   rf   r   s        r   test_ipc_stream_no_batchesr    s    HH  "((<"8"$((+G"H"J(+Sz ! 3E   "D			4	.	. 
/ ]]_F			F	#	#v" 
$ ==----v;! 
/	. 
$	#s   D3E3E	E	c                     ^
p ^p\         P                  ! R\        P                  P	                  V 4      /4      p\
        P                  P                  V4      p\
        P                  P                  V4      W,          8  g   Q hR# )r   r(   N)
r   r   r   r2   r   r,   r   r   rT   get_record_batch_size)Nitemsizer   rB   s       r   test_get_record_batch_sizer    s_    
AH	ubiiooa01	2BNN&&r*E66''.!,???r   c                     \         P                  ! Y'       d   ^M^R7      p\         P                  ! W!R7      p\        W04       R# )r   )nthreadsr   N)r,   serialize_pandasdeserialize_pandasr   )r   r   r   r   s   &&  r   "_check_serialize_pandas_round_tripr    s0    


b1
CC""3@Fv"r   c                      \         P                  ! . RORR7      p RR.p\         P                  ! R. R	OR\        R4      /WR7      p\	        V4       R# )
r   my_indexnamer(   r)   abcindexcolumnsNr   r  g?g333333?r   Indexr   r  r  r  r  r   s      r    test_pandas_serialize_round_tripr    sF    HHYZ0EenG		U4
B 'r*r   c                      \         P                  ! . R
ORR7      p RR.p\         P                  ! R. ROR\        R4      /WR7      p\	        VRR7       R	# )r   r  r  r(   r)   r  r  Tr   Nr   r  r	  r  s      r   )test_pandas_serialize_round_trip_nthreadsr    sH    HHYZ0EenG		U4
B 'rt<r   c                  *   \         P                  ! . R	ORR7      p \         P                  ! \        R4      RR7      p\         P                  P	                  W.4      pRR.p\         P
                  ! R. R
OR\        R4      /VVR7      p\        V4       R# )r   level_1r  defNr(   r)   r  r  r   r  )r   r
  r  
MultiIndexr  r   r  )index1index2r  r  r   s        r   ,test_pandas_serialize_round_trip_multi_indexr  )  st    XXii0FXXd5k-FMM%%v&67EenG		U4
B
 'r*r   c                  F    \         P                  ! 4       p \        V 4       R # r
   )r   r   r  )r   s    r   %test_serialize_pandas_empty_dataframer  8  s    	B&r*r   c                      \         P                  ! \        \        . ROR4      4      4      p \        P
                  ! V 4      p\        P                  ! V4      p\        W 4       R# )r  r  Nr  )r   r   r  r  r,   r  r  r   )r   r   r   s      r   3test_pandas_serialize_round_trip_not_string_columnsr  >  sD    	d367	8B


b
!C""3'Fv"r   c                  Z   \         P                  ! R . RO/. ROR7      p \         P                  ! R . RO/4      p\        P                  ! V RR7      p\        P                  ! V4      p\        W14       \        P                  ! V RR7      p\        P                  ! V4      p\        W04       R# )r=  )r  Fr   TNr   )r   r   r,   r  r  r   )r   r   r   r   s       r   'test_serialize_pandas_no_preserve_indexr  F  s~    	sI&i	8B||S),-H


b
7C""3'Fv(


b
6C""3'Fv"r   c            
         ^p \         P                  ! R\        P                  P	                  V 4      RR\        P
                  RRR./4      p\        P                  P                  V4      pVP                  P                  4       pVP                  4       p\        P                  P                  V4      p\        P                  P                  WE4      pVP                  V4      '       g   Q hR# )r#   r$   r%   r(   r)   r*   r+   N)r   r   r   r2   r   r   r,   r   r   r'   rz  rT   r  r  r`   )r=   r   rB   s_schemas_batchrecons_schemarecons_batchs          r   #test_schema_batch_serialize_methodsr!  T  s    E	ryyu%rvvuh68 
9B NN&&r*E||%%'HooGFF&&x0M66++GCLu%%%%r   c                     R RRR/p R RRR/p\         P                  ! R\         P                  ! 4       4      p\         P                  ! R\         P                  ! 4       V R7      p\         P                  ! W#.VR7      pVP                  4       p\         P                  P                  V4      pVP                  V4      '       g   Q hVP                  V8X  g   Q hV^ ,          P                  e   Q hV^,          P                  V 8X  g   Q hR# )	r  s   bars   kinds   fields   schemar=  r>  rq  N)
r,   r   rR  stringr'   rz  rT   r  r`   rq  )field_metadataschema_metadataf0f1r'   r  r  s          r   'test_schema_serialization_with_metadatar)  d  s    fgx8Nvw	:O	#rwwy	!B	#ryy{^	<BYYx/:F!HFF&&x0M''''!!_444$$,,,$$666r   c                     \         P                  P                  WP                  4      ;_uu_ 4       pVP	                  V 4       R R R 4       R #   + '       g   i     R # ; ir
   )r,   rT   rU   r'   r7   )rB   r   r>   s   && r   r  r  v  s8    	||	,	,5! 
-	,	,	,s   AA	c                     \         P                  P                  V 4      ;_uu_ 4       p\        VP                  4       Uu. uF  q!P                  V4      NK  	  upuuR R R 4       # u upi   + '       g   i     R # ; ir
   )r,   rT   r[   r0   r\   r_   )r   rf   r@   s   &  r   r  r  {  sX    			&	!	!V-263L3L-MN-M  #-MN 
"	!N 
"	!	!s   A+ A&A+&A++A<	c                  V   \         P                  ! R \         P                  ! 4       3.4      p \         P                  ! 4       p\         P                  P                  W4      ;_uu_ 4         RRR4       VP                  4       p\         P                  ! \         P                  ! V4      4      ;_uu_ 4       pVP                  4       pRRR4       \        X4      ^ 8X  g   Q hVP                  P                  V 4      '       g   Q hR#   + '       g   i     L; i  + '       g   i     LZ; i)r   N)r,   r'   int64r   rT   rU   r   r   rZ   r   r]   r`   )r'   r   r   rf   rC   s        r   test_write_empty_ipc_filer.    s     YY"((*-./F  "D		&	& 
' --/C		!	!"//#"6	7	76! 
8u:??<<v&&&& 
'	& 
8	7s   )D5DD	D(	c                  b  a R  oV3R lp \        V ! 4       4      p\        P                  ! V4      p\        P                  P                  S! 4       V4      ;_uu_ 4       pRpV! 4       f   Q h\        V4      V ! 4       8X  g   Q hV! 4       e   Q h RRR4       \        \        V ! 4       4      4      p\        P                  ! V4      p\        P                  P                  S! 4       V4      ;_uu_ 4       pRpV! 4       f   Q h\        V4      V ! 4       8X  g   Q hV! 4       e   Q h RRR4       V ! 4       p\        P                  ! \        4      ;_uu_ 4        \        P                  P                  R\        P                  ! 4       3.V4      p RRR4       \        P                  ! \        4      ;_uu_ 4        \        P                  P                  RV4      p RRR4       R#   + '       g   i     EL]; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)c                  Z    \         P                  ! R \         P                  ! 4       3.4      # )r   )r,   r'   r-  r   r   r   make_schema0test_py_record_batch_reader.<locals>.make_schema  s    yy7BHHJ/011r   c                     < S! 4       p \         P                  ! . RO.V R7      p\         P                  ! ^^..V R7      pW.# )r   r&   r   )r,   r1   )r'   batch1batch2r1  s      r   make_batches1test_py_record_batch_reader.<locals>.make_batches  s;    )V<1a&&9r   Nr   )r   weakrefrefr,   RecordBatchReaderr5   r  iterr   r   r   r-  )r6  r?   r   rf   r1  s       @r   test_py_record_batch_readerr<    s   2  |~&G	W	B				*	*;=+2
4 
47=tF||~---t||
4 8LN+,G	W	B				*	*;=+2
4 
47=tF||~---t||
4 nG	y	!	!%%22rxxz"#W. 
"
 
y	!	!%%224A 
"	!5
4 
4 
4
4 
4 
"	!
 
"	!	!s0   0G#30G77H
7!H#G4	7H	
H	H.	c                      ! R  R4      p \         P                  ! \         P                  ! . R	O\         P                  ! 4       R7      .R.R7      \         P                  ! \         P                  ! . R
O\         P                  ! 4       R7      .R.R7      .pV ! V4      p\         P                  P                  V4      p\         P                  P                  V4      pVP                  4       V8X  g   Q h\         P                  P                  V4      pVP                  4       V8X  g   Q h\         P                  P                  W!^ ,          P                  R7      pVP                  4       V8X  g   Q h\         P                  ! \         P                  ! R\         P                  ! 4       4      .4      p\         P                  P                  W%R7      pVP                  4       VP                  V4      8X  g   Q h\        P                  ! \         P                  P                   RR7      ;_uu_ 4        \         P                  P                  V\         P                  ! \         P                  ! R\         P"                  ! \         P                  ! 4       4      4      .4      R7       RRR4       \        P                  ! \$        4      ;_uu_ 4        \         P                  P                  V^ ,          R,          4       RRR4       \        P                  ! \$        4      ;_uu_ 4        \         P                  P                  W1^ ,          R7       RRR4       R#   + '       g   i     L; i  + '       g   i     Lw; i  + '       g   i     R# ; i)c                   0   a  ] tR tRt o R tRR ltRtV tR# )Atest_record_batch_reader_from_arrow_stream.<locals>.StreamWrapperi  c                    Wn         R # r
   r?   )r   r?   s   &&r   r   Jtest_record_batch_reader_from_arrow_stream.<locals>.StreamWrapper.__init__  s    "Lr   Nc                    \         P                  P                  V P                  ^ ,          P                  V P                  4      pVP                  V4      # )r   )r,   r:  r5   r?   r'   __arrow_c_stream__)r   requested_schemarf   s   && r   rD  Ttest_record_batch_reader_from_arrow_stream.<locals>.StreamWrapper.__arrow_c_stream__  sA    ))66Q&&6F,,-=>>r   rA  r
   )rF   rG   rH   rI   r   rD  rJ   rK   rL   s   @r   StreamWrapperr?    s     	#	? 	?r   rG  r   r=  r  r&   Field 0 cannot be castrx  Nr   rC  r#   r   )r,   r1   r   r-  r4   r5   r:  from_streamr   r'   r   r_  castr   r   libArrowTypeErrorlist_r   )rG  rW  wrapperr   rf   good_schemas         r   *test_record_batch_reader_from_arrow_streamrQ    sW   ? ? 	)"((*=>seL
)"((*=>seLD D!G xx$$T*H!!--h7F??((( !!--g6F??((( !!--g1gnn-MF??((( ))RXXc288:678K!!--g-JF??k :::: 
rvv,,4L	M	M
((BIIrxxRXXbhhj5I'J&KL 	) 	
 
N 
y	!	!
((a6 
" 
y	!	!
((q'(B 
"	! 
N	M 
"	! 
"	!	!s%   -A3M
.M'"(M:M$	'M7	:N	c                  n   \         P                  ! \         P                  ! R \         P                  ! 4       4      .4      p \         P                  ! \         P
                  ! . RO\         P                  ! 4       R7      .R .R7      \         P                  ! \         P
                  ! . R	O\         P                  ! 4       R7      .R .R7      .p\         P                  P                  V4      p\         P                  P                  W4      pVP                  V 4      P                  4       V8X  g   Q h\         P                  ! \         P                  ! R \         P                  ! 4       4      .4      p\         P                  P                  W4      pVP                  V4      P                  4       VP                  V4      8X  g   Q h\         P                  P                  W4      p\        P                  ! \        RR7      ;_uu_ 4        VP                  \         P                  ! . 4      4       RRR4       \         P                  P                  W4      p\        P                  ! \         P                  P                   RR7      ;_uu_ 4        VP                  \         P                  ! \         P                  ! R \         P"                  ! \         P                  ! 4       4      4      .4      4       RRR4       \         P                  ! \         P                  ! R \         P$                  ! 4       4      .4      p \         P
                  ! \&        P(                  ! R^^4      .\         P$                  ! 4       R7      p\         P                  ! V.R .R7      \         P                  ! V.R .R7      .p\         P                  P                  V4      p\         P                  P                  W4      pVP                  V 4      P                  4       V8X  g   Q hR#   + '       g   i     EL; i  + '       g   i     EL@; i)
r=  r   r  zTarget schema's field namesrx  NrH  i  r   rI  )r,   r'   r   r-  r1   r   r4   r5   r:  rK  r   r_  r   r   r)  rL  rM  rN  date32datetimedate)
schema_srcrW  	table_srcrf   
schema_dstarrs         r   test_record_batch_reader_castrZ    s   BHHS"((*567J
)"((*=>seL
)"((*=>seLD %%d+I !!..z@F;;z"++-::: BHHS"((*567J!!..z@F;;z"++-
1KKKK !!..z@F	z)F	G	GBIIbM" 
H !!..z@F	rvv,,4L	M	MBIIrxxRXXbhhj-ABCDE 
N
 BHHS"))+678J
((HMM$2./biik
BCOOSE#/#se1TUD%%d+I!!..z@F;;z"++-::: 
H	G	G
 
N	M	Ms   &P	A#P#P 	#P4	c                     \         P                  ! \         P                  ! R \         P                  ! 4       4      .4      p \         P                  ! \         P
                  ! . RO\         P                  ! 4       R7      .R .R7      .p\         P                  ! \         P
                  ! . R	O\         P                  ! 4       R7      .R .R7      .p\         P                  P                  V4      p\         P                  P                  V4      p\         P                  P                  W4      p\         P                  ! \         P                  ! R \         P                  ! 4       4      .4      pVP                  V4      P                  4       VP                  V4      8X  g   Q h\         P                  P                  W4      p\         P                  ! \         P                  ! R \         P                  ! 4       RR7      .4      pVP                  V4      P                  4       VP                  V4      8X  g   Q h\         P                  P                  W4      pVP                  V4      p\        P                  ! \         P                  P                  RR7      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     R# ; i)
r=  Nr   r  F)nullablezCan't cast arrayrx  )r   r   Nr   )r,   r'   r   r-  r1   r   r4   r5   r:  r_  rK  r   r   r   rL  r   )rV  data_with_nullsdata_without_nullstable_with_nullstable_without_nullsrf   rX  casted_readers           r   #test_record_batch_reader_cast_nullsrb    s   BHHS"((*567J
,RXXZ@A#OO 	)"((*=>seL xx,,_=((//0BC !!..zKFBHHS"((*567J;;z"++-1A1F1Fz1RRRR !!..zNFBHHS"((*uEFGJ;;z"++-1D1I1I*1UUUU !!..zKFKK
+M	rvv**2D	E	E  
F	E	E	Es   J55K	c                      \         P                  ! R . RO/4      p RRRR/p\         P                  ! 4       p\         P                  P	                  W P
                  VR7      ;_uu_ 4       pVP                  V 4       RRR4       VP                  4       p\         P                  P                  V4      ;_uu_ 4       pVP                  V8X  g   Q h RRR4       R#   + '       g   i     Lf; i  + '       g   i     R# ; i)r=  s   creators   tests   versions   0.1.0r#  Nr   
r,   rC   r   rT   rU   r'   r6   r   r[   rq  )tblmetar   wr  rs         r   +test_record_batch_file_writer_with_metadatari  0  s    
((C#
$CX6D  "D	zzD	9	9Q	c 
: ]]_F			&	!	!QzzT!!! 
"	!	 
:	9 
"	!	!s   )C:C,C)	,C=	c                     \         P                  ! R . RO/4      p \         P                  ! 4       p\         P                  P	                  WP
                  4      ;_uu_ 4       pVP                  V 4       RRR4       VP                  4       p\         P                  P                  V4      ;_uu_ 4       pVP                  e   Q h RRR4       R#   + '       g   i     Lc; i  + '       g   i     R# ; i)r=  Nr   rd  )re  r   rg  r  rh  s        r   1test_record_batch_file_writer_with_empty_metadatark  >  s    
((C#
$C  "D	zz	*	*a	c 
+ ]]_F			&	!	!Qzz!!! 
"	!	 
+	* 
"	!	!s   !C2C!C	!C2	c                    V ! R/ VB pVP                  4       pVP                  4        F  w  rEVf   K  \        V\        4      '       g   TMRV R2pVR8X  d+   \        P
                  P                  V4      P                  pM0VR8X  d*   \        P
                  P                  V4      P                  pV RV 2V9   d   K  Q h	  R # )N"r4  r"  =r   )	__repr__itemsra   r  r,   rT   r7  r  r'  )options_objoptions_argsrS   rl  argvalr,  s   &&     r   check_ipc_options_reprru  K  s    )L)GD &&(;%c3//r#b\$$FF$$S)..E&&FF**3/44Eaw4''' )r   c                    V P                   R 8X  d3   RRRRR\        P                  P                  P                  RRRRR	RR
R/# V P                   R8X  d3   RRRRR\        P                  P                  P
                  RRRRR	RR
R/# / # )defaultr#  Fr$  r"  r  Nr   TrO  rP  allr  )r   r,   rT   r'  r%  r(  r   s   &r   write_options_argsry  ]  s    }}	!5 6 6 9 944$e %
 	
 
%	4 6 6 9 965$d $
 	
 	r   ry  rw  rx  )indirectc                 N    \        \        P                  P                  V 4       R # r
   )ru  r,   rT   r  )ry  s   &r   test_write_options_reprr|  w  s    
 266113EFr   c           	          V P                   R 8X  d-   RRR\        P                  P                  P                  RRRR/# V P                   R8X  d/   RRR\        P                  P                  P
                  RRR. R	O/# / # )
rw  r3  Tr4  r   r5  Nrx  Fr   )r   r,   rT   r7  r8  r9  r   s   &r   read_options_argsr~    s    }}	!"D 0 0 4 44t	
 	
 
%	"E 0 0 A A5y	
 	
 	r   r~  c                 N    \        \        P                  P                  V 4       R # r
   )ru  r,   rT   r6  )r~  s   &r   test_read_options_reprr    s     266002CDr   ri   )qcollectionsr   rT  r   r   r   r2   r  	threadingr8  numpyr   ImportErrorpyarrowr,   pyarrow.tests.utilr   r   pandas.testingr   pandasr   r   rO   rl   rr   r   ry   r{   r}   r   r   r   r   r   markparametrizer   r   r   r   r   	processesr   r   r   rT   r6  r   r   r   r   r   r  r  r  r  r-  r  r'  r(  r1  r;  rH  rZ  rb  rd  rf  rj  rn  rv  r  r  r  r  r  r  r  Threadr  r  r  socketsr  r  r  r  r  r  r  r  r  r  r  r  r  r  r!  r)  r  r  r.  r<  rQ  rZ  rb  ri  rk  ru  ry  r|  r~  r  r   r   r   <module>r     s*  $ !  	        =	1
$ $N>
 >6
* 
 8Z 8     ! ! 
LL LL	 	2	2/21 #* 
#	
# . ) )  0  0$ . . ;2 FFFFe,% :	:1 FFFFe,% 
&	
&/ ? ?( 5 5.!$  <.,b FFFFt,FFT2FFBFF,B,B,E,EFFFT,.FF,B,B,E,E  G% !!.*D2H-V!IH# ) ) ! !!= $0	( & &,(
4"$)) $B8* 8< ! ! / / # #    "      h%78"A 9 "AJ$ @ @ # # + + = = + + + +
 # # 
# 
# & &7$"
O
' *Z.Cb";J!:"
"($  2 9e,t  =G= G
  & )U+d  <E<Eo+  	B  		s"   Y5 
Z 5	ZZZZ