
    z-Ph                        d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZ	ej
        j        Zej                            ej                            e                    Zej                            d          pej                            ed          ZddgZd Z e            d             Z e            d	             Zd
 Zd Z G d d          Z ej        d          d             Z ej        d          d             Zd Zd Z d Z!d Z"d Z#d Z$d Z%d Z&d Z'd Z(d Z)d Z*d Z+d Z,d  Z-d! Z.d" Z/d# Z0d$ Z1d% Z2d& Z3d' Z4d( Z5dS ))    )	lru_cacheNARROW_GDB_SCRIPTz../../../cpp/gdb_arrow.pygdbz--nxc                  `    i } dD ](}	 t           j        |         | |<   # t          $ r Y %w xY w| S )N)PATHLD_LIBRARY_PATH)osenvironKeyError)envvars     V/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pyarrow/tests/test_gdb.pyenvironment_for_gdbr   *   sQ    
C*  	z#CHH 	 	 	D	Js   
++c                      	 t          j        t          dgz   t                      dt           j        t           j        t           j                  } n# t          $ r Y dS w xY w| j        dk    S )Nz	--versionr   )r   bufsizestdinstdoutstderrF)
subprocessrungdb_commandr   PIPESTDOUTFileNotFoundError
returncode)procs    r   is_gdb_availabler   4   sv    	 ~k[M9"5"7"7$.O%/_%/%6	8 8 8
    uu?as   AA 
AAc                  F    t          j        d          } | 
J d            | S )Npython3z Couldn't find python3 executable)shutilwhich)paths    r   python_executabler#   C   s+    <	""D?K    c                  N    t                      st          j        d           d S d S )Nzgdb command unavailable)r   pytestskip r$   r   skip_if_gdb_unavailabler)   J   s1     /-...../ /r$   c                  z    t           j                            t                    st	          j        d           d S d S )Nzgdb script not found)r	   r"   exists
gdb_scriptr&   r'   r(   r$   r   skip_if_gdb_script_unavailabler-   O   s9    7>>*%% ,*+++++, ,r$   c                   F    e Zd ZdZdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )
GdbSessionNTc                     t                      }|                    |           t          j        t          t          |          z   |dt          j        t          j                  | _        g | _        d| _	        d S )Nr   )r   r   r   r   r$   )
r   updater   Popenr   listr   r   last_stdoutlast_stdout_line)selfargsr   gdb_envs       r   __init__zGdbSession.__init__X   sl    %''s$[4::%=)0!+5?,6O= = =	  #r$   c                 f   | j                             d          s2| j                                        | j        j                            d          }| j        rGt          j        j        	                    |           t          j        j        
                                 |                    d          \  }}}|rD| j                            | j                    | j                            ||z              || _         n|dk    sJ | xj         |z  c_         | j                             d          s| j                                        | j                                        t          d          d                    | j                                      d          }g | _        d| _         |S )zW
        Record output until the gdb prompt displays.  Return recorded output.
        s   (gdb) Ni      
r$   z#gdb session terminated unexpectedlyutf-8)r5   
startswithr   pollr   readverbosesysbufferwriteflush
rpartitionr4   appendIOErrorjoindecode)r6   blocksep	last_lineouts        r   wait_until_readyzGdbSession.wait_until_readyc   s   
 (33I>> 	3y~~'I$))$//E| *
!''...
!'')))$)$4$4U$;$;!E3	 3 ''(=>>> ''444(1%%||||%%2%% (33I>> 	3y~~' 9>>'?@@@hht'((//88 #
r$   c                 L   |                     d          dz   }| j        rGt          j        j                            |           t          j        j                                         | j        j                            |           | j        j                                         d S )Nr<   r;   )	encoder@   rA   r   rB   rC   rD   r   r   r6   lines     r   issue_commandzGdbSession.issue_command   s    {{7##e+< 	&J##D)))J##%%%	d###	r$   c                 T    |                      |           |                                 S N)rS   rN   rQ   s     r   run_commandzGdbSession.run_command   s(    4   $$&&&r$   c                     |                      d|           }t          j        dd|          \  }}|dk    s
J |            |                                S )zT
        Ask gdb to print the value of an expression and return the result.
        zp z	^\$\d+ =     )rV   resubnstrip)r6   exprrM   ns       r   print_valuezGdbSession.print_value   sU     {D{{++r3//QAvvvsvvvyy{{r$   c                 ,   |                      d          }dt          j        |          z   dz   }t          j        ||          }|t	          j        d|            t          |d                   }|                      d|           }d| |v sJ dS )	zJ
        Select the innermost frame with the given function name.
        z
info stackz(?mi)^#(\d+)\s+.* in z\bNz$Could not select frame for function rY   zframe zin )rV   rZ   escapesearchr&   failint)r6   	func_namerM   patm	frame_nums         r   select_framezGdbSession.select_frame   s     |,,&9)=)==EIc39KJyJJKKK!II	3	3344 Y  C''''''r$   c                    | j         w| j         j                                         | j         j                                         | j                                          | j                                          d | _         d S d S rU   )r   r   closer   killwaitr6   s    r   rH   zGdbSession.join   sn    9 IO!!###I""$$$INNINNDIII ! r$   c                 .    |                                   d S rU   )rH   rn   s    r   __del__zGdbSession.__del__   s    		r$   )__name__
__module____qualname__r   r@   r9   rN   rS   rV   r_   ri   rH   rp   r(   r$   r   r/   r/   T   s        DG	$ 	$ 	$  8     ' ' '  ( ( ("      r$   r/   session)scopec               #     K   t                       t          dt                                } 	 |                                  |                     d           |                     d           |                     d           |                     d           | V  |                                  d S # |                                  w xY w)Nz-qzset confirm offzset print array-indexes onzset width unlimitedzset charset UTF-8)r)   r/   r#   rN   rV   rH   )r   s    r   r   r      s      
T,..
/
/C	)***4555-...+,,,			








s   A,B0 0Cc                    dt           j        j        vrt          j        d           t                       |                     dt                      t          j	        dk    rdnd}t          j                            |          }|r|                     d| d|            d	}|                     d
| d          }d|v sd|v s
J |            |                     d           | S )Ndebz%Arrow C++ debug symbols not availablezsource win32r   r   zset env  z>from pyarrow.lib import _gdb_test_session; _gdb_test_session()zrun -c ''zTrace/breakpoint trapzreceived signalzarrow::gdb::TestSession)pacpp_build_info
build_typer&   r'   r-   rV   r,   rA   platformr	   r
   getri   )r   lib_path_varlib_pathcoderM   s        r   	gdb_arrowr      s   B%000;<<<"$$$OO*j**+++ \W4466:KLz~~l++H > 	<<<<(<<===KD
//,T,,,
-
-C#s**$$$s$$$.///Jr$   c                 n    |                      d          }|                    d          s
J |            d S )Nzshow versionz	GNU gdb ()rV   r=   )r   rM   s     r   test_gdb_sessionr      s9    
//.
)
)C>>+&&+++++++r$   c                 @    |                      d          }|dk    sJ d S )Nz42 + 143)r_   )r   ss     r   test_gdb_arrowr      s&    h''A999999r$   c                     |                      |          }t          |t          j                  r!|                    |          s
J |            dS ||k    sJ dS )z/
    Check printing a stack-located value.
    N)r_   
isinstancerZ   Patternmatchr   r]   expectedr   s       r   check_stack_reprr      s`     	A(BJ'' ~~a  ##!#####H}}}}}}r$   c                 z    |                      d|           }||k    r|                    d|           sJ dS dS )zA
    Check printing a heap-located value, given its address.
    *rz   N)r_   endswithr   s       r   check_heap_reprr      sO     	
D

##AH}}zz.h..))))) }))r$   c                     t          | dd           t          | dd           t          | dd           t          | dd           t          | d	d
           t          | dd           d S )N	ok_statuszarrow::Status::OK()error_statusz*arrow::Status::IOError("This is an error")error_detail_statuszXarrow::Status::IOError("This is an error", detail=[custom-detail-id] "This is a detail")	ok_resultzarrow::Result<int>(42)error_resultz>arrow::Result<int>(arrow::Status::IOError("This is an error"))error_detail_resultzlarrow::Result<int>(arrow::Status::IOError("This is an error", detail=[custom-detail-id] "This is a detail"))r   r   s    r   test_statusr      s    Y-BCCCYAC C C(	89 9 9
 Y-EFFF>HJ J J (	9: : : : :r$   c                     t          | dd           t          | dd           t          | dd           t          | dd           d S )	Nbuffer_nullz"arrow::Buffer of size 0, read-only
buffer_abc)arrow::Buffer of size 3, read-only, "abc"buffer_special_charsz=arrow::Buffer of size 12, read-only, "foo\"bar\000\r\n\t\037"buffer_mutablez.arrow::MutableBuffer of size 3, mutable, "abc"r   r   s    r   test_buffer_stackr     s    Y9; ; ;Y@B B B)HJ J J Y 0EG G G G Gr$   c                 J    t          | dd           t          | dd           d S )Nheap_bufferr   zheap_buffer_mutable.get()z'arrow::Buffer of size 3, mutable, "abc"r   r   s    r   test_buffer_heapr     sB    I}?A A AI:=? ? ? ? ?r$   c                    d}t          | dd           t          | dd| d           t          | dd| d           t          | d	d
           t          | dd| d           t          | dd| d           d}t          | dd           t          | dd| d           t          | dd| d           t          | dd           t          | dd| d           t          | dd| d           d S )N&98765432109876543210987654321098765432decimal128_zerozarrow::Decimal128(0)decimal128_poszarrow::Decimal128()decimal128_negzarrow::Decimal128(-basic_decimal128_zerozarrow::BasicDecimal128(0)basic_decimal128_poszarrow::BasicDecimal128(basic_decimal128_negzarrow::BasicDecimal128(-L9876543210987654321098765432109876543210987654321098765432109876543210987654decimal256_zerozarrow::Decimal256(0)decimal256_poszarrow::Decimal256(decimal256_negzarrow::Decimal256(-basic_decimal256_zerozarrow::BasicDecimal256(0)basic_decimal256_poszarrow::BasicDecimal256(basic_decimal256_negzarrow::BasicDecimal256(-r   )r   v128v256s      r   test_decimalsr     s   3DY 13IJJJY 01$1113 3 3Y 0242224 4 4Y 702 2 2Y 66t6668 8 8Y 677779 9 93DY 13IJJJY 01$1113 3 3Y 0242224 4 4Y 702 2 2Y 66t6668 8 8Y 677779 9 9 9 9r$   c                 J    t          | dd           t          | dd           d S )Nzempty_metadata.get()z!arrow::KeyValueMetadata of size 0zmetadata.get()zcarrow::KeyValueMetadata of size 2 = {["key_text"] = "some value", ["key_binary"] = "z\000\037\377"}r   r   s    r   test_metadatar   ;  sI    I579 9 9#
MO O O O Or$   c                    t          | dd           t          | dd           t          | dd           t          | dd           t          | d	d
           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd            t          | d!d"           t          | d#d$           t          | d%d&           t          | d'd(           t          | d)d*           t          | d+d,           t          | d-d.           t          | d/d0           t          | d1d2           t          | d3d4           t          | d5d6           t          | d7d8           t          | d9d:           t          | d;d<           t          | d=d>           t          | d?d@           t          | dAdB           t          | dCdD           t          | dEdF           t          | dGdH           d S )IN	null_typearrow::null()	bool_typearrow::boolean()date32_typezarrow::date32()date64_typezarrow::date64()time_type_sz&arrow::time32(arrow::TimeUnit::SECOND)time_type_msz%arrow::time32(arrow::TimeUnit::MILLI)time_type_usz%arrow::time64(arrow::TimeUnit::MICRO)time_type_ns$arrow::time64(arrow::TimeUnit::NANO)timestamp_type_sz)arrow::timestamp(arrow::TimeUnit::SECOND)timestamp_type_ms_timezonez8arrow::timestamp(arrow::TimeUnit::MILLI, "Europe/Paris")timestamp_type_usz(arrow::timestamp(arrow::TimeUnit::MICRO)timestamp_type_ns_timezone7arrow::timestamp(arrow::TimeUnit::NANO, "Europe/Paris")day_time_interval_typezarrow::day_time_interval()month_interval_typezarrow::month_interval()month_day_nano_interval_typez arrow::month_day_nano_interval()duration_type_sz(arrow::duration(arrow::TimeUnit::SECOND)duration_type_nsz&arrow::duration(arrow::TimeUnit::NANO)decimal128_typearrow::decimal128(16, 5)decimal256_typezarrow::decimal256(42, 12)binary_typezarrow::binary()string_typezarrow::utf8()large_binary_typezarrow::large_binary()large_string_typezarrow::large_utf8()fixed_size_binary_typezarrow::fixed_size_binary(10)	list_typearrow::list(arrow::uint8())large_list_type&arrow::large_list(arrow::large_utf8())fixed_size_list_type+arrow::fixed_size_list(arrow::float64(), 3)map_type_unsorted=arrow::map(arrow::utf8(), arrow::binary(), keys_sorted=false)map_type_sortedz<arrow::map(arrow::utf8(), arrow::binary(), keys_sorted=true)struct_type_emptyzarrow::struct_({})struct_typejarrow::struct_({arrow::field("ints", arrow::int8()), arrow::field("strs", arrow::utf8(), nullable=false)})sparse_union_typezarrow::sparse_union(fields={arrow::field("ints", arrow::int8()), arrow::field("strs", arrow::utf8(), nullable=false)}, type_codes={7, 42})dense_union_typezarrow::dense_union(fields={arrow::field("ints", arrow::int8()), arrow::field("strs", arrow::utf8(), nullable=false)}, type_codes={7, 42})dict_type_unordered?arrow::dictionary(arrow::int16(), arrow::utf8(), ordered=false)dict_type_orderedz>arrow::dictionary(arrow::int16(), arrow::utf8(), ordered=true)	uuid_type[arrow::ExtensionType "extension<arrow.uuid>" with storage type arrow::fixed_size_binary(16)r   r   s    r   test_types_stackr   D  s   Y_===Y-?@@@Y/@AAAY/@AAAY=? ? ?Y<> > >Y<> > >Y;= = =Y 2@B B B/BD D D Y 3?A A A/AC C C Y 813 3 3Y 5.0 0 0Y >79 9 9Y 1?A A AY 2=? ? ? Y 1/1 1 1Y 102 2 2 Y/@AAAY???Y 35LMMMY 35JKKKY 835 5 5 Y24 4 4Y 1=? ? ?Y 6BD D D&GI I I $FH H H Y 3)+ + +=
AC C C
 &
! ! !
 %
! ! ! (IK K K &HJ J J ;
:< < < < <r$   c                    t          | dd           t          | dd           t          | dd           t          | dd           t          | d	d
           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           d S )Nheap_null_typer   heap_bool_typer   heap_time_type_nsr   heap_timestamp_type_ns_timezoner   heap_decimal128_typer   heap_list_typer   heap_large_list_typer   heap_fixed_size_list_typer   heap_map_typer   heap_struct_typer   heap_dict_typer   heap_uuid_typer   r   r   s    r   test_types_heapr     sY   I/AAAI/1CDDDI2:< < <4AC C C I5.0 0 0 I/13 3 3I5<> > >I:AC C C?GI I I %
AC C C
 #IK K K #
:< < < < <r$   c                 J    t          | dd           t          | dd           d S )N	int_field$arrow::field("ints", arrow::int64())float_fieldz8arrow::field("floats", arrow::float32(), nullable=false)r   r   s    r   test_fields_stackr    sD    Y;= = ==BD D D D Dr$   c                 (    t          | dd           d S )Nheap_int_fieldr  r   r   s    r   test_fields_heapr    s&    I/:< < < < <r$   c                    t          | dd           t          | dd           t          | dd           t          | dd           t          | d	d
           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd            t          | d!d"           t          | d#d$           t          | d%d&           t          | d'd(           t          | d)d*           t          | d+d,           t          | d-d.           t          | d/d0           t          | d1d2           t          | d3d4           t          | d5d6           t          | d7d8           t          | d9d:           t          | d;d<           t          | d=d>           t          | d?d@           t          | dAdB           t          | dCdD           t          | dEdF           t          | dGdH           t          | dIdJ           t          | dKdL           t          | dMdN           t          | dOdP           t          | dQdR           t          | dSdT           t          | dUdV           t          | dWdX           t          | dYdZ           t          | d[d\           t          | d]d^           t          | d_d`           t          | dadb           t          | dcdd           t          | dedf           t          | dgdh           t          | didj           t          | dkdl           t          | dmdn           t          | dodp           t          | dqdr           t          | dsdt           t          | dudv           t          | dwdx           t          | dydz           t          | d{d|           t          | d}d~           t          | dd           t          | dt          j        d                     t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dt          j        d                     t          | dd           t          | dt          j        d                     t          | dd           t          | dd           d S )Nnull_scalararrow::NullScalarbool_scalar"arrow::BooleanScalar of value truebool_scalar_nullz"arrow::BooleanScalar of null valueint8_scalarzarrow::Int8Scalar of value -42uint8_scalarzarrow::UInt8Scalar of value 234int64_scalarz0arrow::Int64Scalar of value -9223372036854775808uint64_scalarz1arrow::UInt64Scalar of value 18446744073709551615half_float_scalarz,arrow::HalfFloatScalar of value -1.5 [48640]float_scalarz arrow::FloatScalar of value 1.25double_scalarz arrow::DoubleScalar of value 2.5time_scalar_sz!arrow::Time32Scalar of value 100stime_scalar_msz#arrow::Time32Scalar of value 1000mstime_scalar_usz$arrow::Time64Scalar of value 10000ustime_scalar_nsz%arrow::Time64Scalar of value 100000nstime_scalar_nullz&arrow::Time64Scalar of null value [ns]duration_scalar_sz$arrow::DurationScalar of value -100sduration_scalar_msz&arrow::DurationScalar of value -1000msduration_scalar_usz'arrow::DurationScalar of value -10000usduration_scalar_nsz(arrow::DurationScalar of value -100000nsduration_scalar_nullz(arrow::DurationScalar of null value [ns]timestamp_scalar_sz4arrow::TimestampScalar of value 12345s [no timezone]timestamp_scalar_msz7arrow::TimestampScalar of value -123456ms [no timezone]timestamp_scalar_usz7arrow::TimestampScalar of value 1234567us [no timezone]timestamp_scalar_nsz9arrow::TimestampScalar of value -12345678ns [no timezone]timestamp_scalar_nullz6arrow::TimestampScalar of null value [ns, no timezone]timestamp_scalar_s_tzz7arrow::TimestampScalar of value 12345s ["Europe/Paris"]timestamp_scalar_ms_tzz:arrow::TimestampScalar of value -123456ms ["Europe/Paris"]timestamp_scalar_us_tzz:arrow::TimestampScalar of value 1234567us ["Europe/Paris"]timestamp_scalar_ns_tzz<arrow::TimestampScalar of value -12345678ns ["Europe/Paris"]timestamp_scalar_null_tzz9arrow::TimestampScalar of null value [ns, "Europe/Paris"]month_interval_scalarz'arrow::MonthIntervalScalar of value 23Mmonth_interval_scalar_nullz(arrow::MonthIntervalScalar of null valueday_time_interval_scalarz/arrow::DayTimeIntervalScalar of value 23d-456msday_time_interval_scalar_nullz*arrow::DayTimeIntervalScalar of null valuemonth_day_nano_interval_scalarz6arrow::MonthDayNanoIntervalScalar of value 1M23d-456ns#month_day_nano_interval_scalar_nullz/arrow::MonthDayNanoIntervalScalar of null valuedate32_scalarz-arrow::Date32Scalar of value 23d [1970-01-24]date32_scalar_nullz!arrow::Date32Scalar of null valuedate64_scalarz6arrow::Date64Scalar of value 3888000000ms [1970-02-15]date64_scalar_nullz!arrow::Date64Scalar of null valuedecimal128_scalar_nullz=arrow::Decimal128Scalar of null value [precision=10, scale=4]decimal128_scalar_pos_scale_posAarrow::Decimal128Scalar of value 123.4567 [precision=10, scale=4]decimal128_scalar_pos_scale_negzBarrow::Decimal128Scalar of value -123.4567 [precision=10, scale=4]decimal128_scalar_neg_scale_poszFarrow::Decimal128Scalar of value 1.234567e+10 [precision=10, scale=-4]decimal128_scalar_neg_scale_negzGarrow::Decimal128Scalar of value -1.234567e+10 [precision=10, scale=-4]decimal256_scalar_nullz=arrow::Decimal256Scalar of null value [precision=50, scale=4]decimal256_scalar_pos_scale_posharrow::Decimal256Scalar of value 123456789012345678901234567890123456789012.3456 [precision=50, scale=4]decimal256_scalar_pos_scale_negziarrow::Decimal256Scalar of value -123456789012345678901234567890123456789012.3456 [precision=50, scale=4]decimal256_scalar_neg_scale_poszmarrow::Decimal256Scalar of value 1.234567890123456789012345678901234567890123456e+49 [precision=50, scale=-4]decimal256_scalar_neg_scale_negznarrow::Decimal256Scalar of value -1.234567890123456789012345678901234567890123456e+49 [precision=50, scale=-4]binary_scalar_nullz!arrow::BinaryScalar of null valuebinary_scalar_unallocatedz*arrow::BinaryScalar of value <unallocated>binary_scalar_emptyz'arrow::BinaryScalar of size 0, value ""binary_scalar_abcz*arrow::BinaryScalar of size 3, value "abc"binary_scalar_bytesz3arrow::BinaryScalar of size 3, value "\000\037\377"large_binary_scalar_abcz/arrow::LargeBinaryScalar of size 3, value "abc"string_scalar_nullz!arrow::StringScalar of null valuestring_scalar_unallocatedz*arrow::StringScalar of value <unallocated>string_scalar_emptyz'arrow::StringScalar of size 0, value ""string_scalar_heheu-   arrow::StringScalar of size 6, value "héhé"string_scalar_invalid_charsz:arrow::StringScalar of size 11, value "abc\x00def\\xffghi"large_string_scalar_heheu2   arrow::LargeStringScalar of size 6, value "héhé"fixed_size_binary_scalarz3arrow::FixedSizeBinaryScalar of size 3, value "abc"fixed_size_binary_scalar_nullz=arrow::FixedSizeBinaryScalar of size 3, null with value "   "dict_scalarz_^arrow::DictionaryScalar of index arrow::Int8Scalar of value 42, dictionary arrow::StringArray dict_scalar_nullzjarrow::DictionaryScalar of type arrow::dictionary(arrow::int8(), arrow::utf8(), ordered=false), null valuelist_scalarznarrow::ListScalar of value arrow::Int32Array of length 3, offset 0, null count 0 = {[0] = 4, [1] = 5, [2] = 6}list_scalar_nullzAarrow::ListScalar of type arrow::list(arrow::int32()), null valuelarge_list_scalarzsarrow::LargeListScalar of value arrow::Int32Array of length 3, offset 0, null count 0 = {[0] = 4, [1] = 5, [2] = 6}large_list_scalar_nullzLarrow::LargeListScalar of type arrow::large_list(arrow::int32()), null valuefixed_size_list_scalarzwarrow::FixedSizeListScalar of value arrow::Int32Array of length 3, offset 0, null count 0 = {[0] = 4, [1] = 5, [2] = 6}fixed_size_list_scalar_nullzXarrow::FixedSizeListScalar of type arrow::fixed_size_list(arrow::int32(), 3), null valuestruct_scalarz~arrow::StructScalar = {["ints"] = arrow::Int32Scalar of value 42, ["strs"] = arrow::StringScalar of size 9, value "some text"}struct_scalar_nullzarrow::StructScalar of type arrow::struct_({arrow::field("ints", arrow::int32()), arrow::field("strs", arrow::utf8())}), null valuesparse_union_scalarzMarrow::SparseUnionScalar of type code 7, value arrow::Int32Scalar of value 43sparse_union_scalar_nullzU^arrow::SparseUnionScalar of type arrow::sparse_union\(.*\), type code 7, null value$dense_union_scalarzLarrow::DenseUnionScalar of type code 7, value arrow::Int32Scalar of value 43dense_union_scalar_nullzS^arrow::DenseUnionScalar of type arrow::dense_union\(.*\), type code 7, null value$extension_scalarzarrow::ExtensionScalar of type "extension<arrow.uuid>", value arrow::FixedSizeBinaryScalar of size 16, value "0123456789abcdef"extension_scalar_nullzBarrow::ExtensionScalar of type "extension<arrow.uuid>", null valuer   rZ   compiler   s    r   test_scalars_stackr_    s	   Y/BCCCY9; ; ;Y 29; ; ;Y57 7 7Y68 8 8YGI I IYHJ J JY 3CE E EY79 9 9Y79 9 9 Y8: : :Y 0:< < <Y 0;= = =Y 0<> > >Y 2=? ? ? Y 3;= = =Y 4=? ? ?Y 4>@ @ @Y 4?A A AY 6?A A A '>@ @ @ (AC C C (AC C C (CE E E *@B B B *AC C C +DF F F +DF F F +FH H H -CE E E Y 7>@ @ @Y <?A A AY :FH H HY ?AC C C3@B B B 89; ; ; YDF F FY 48: : :YMO O OY 48: : : +GI I I 4KM M M 4LN N N 4
$& & & 4
$& & &
 +GI I I 4
#% % %
 4
#% % %
 4
$& & &
 4
$& & & '+- - - .46 6 6 (13 3 3 &46 6 6 (>@ @ @ ,9; ; ; '+- - - .46 6 6 (13 3 3 '79 9 9 0EG G G -<> > > -=? ? ? 2GI I I =

/	1 	12 2 2 %
   =
JL L L %KM M M &
JL L L +
   +
JL L L 0
AC C C
 ?
HJ J J '
=? ? ? (
02 2 2 -rz(0) 0)* * * '
02 2 2 ,bj(/) /)* * *
 %
$& & &
 *LN N N N Nr$   c                     t          | dd           t          | dd           t          | dd           t          | dd           t          | d	d
           t          | dd           d S )Nheap_null_scalarr
  heap_bool_scalarr  heap_decimal128_scalarr5  heap_decimal256_scalarr;  heap_map_scalarz}arrow::MapScalar of type arrow::map(arrow::utf8(), arrow::int32(), keys_sorted=false), value length 2, offset 0, null count 0heap_map_scalar_nullzaarrow::MapScalar of type arrow::map(arrow::utf8(), arrow::int32(), keys_sorted=false), null valuer   r   s    r   test_scalars_heaprg    s    I13FGGGI18: : :+KM M M +
#% % % $
FH H H )
*, , , , ,r$   c                 (    t          | dd           d S )Nint32_array_datazuarrow::ArrayData of type arrow::int32(), length 4, offset 0, null count 1 = {[0] = -5, [1] = 6, [2] = null, [3] = 42}r   r   s    r   test_array_datarj    s/    %
DF F F F Fr$   c                 J    t          | dd           t          | dd           d S )Nint32_arrayaarrow::Int32Array of length 4, offset 0, null count 1 = {[0] = -5, [1] = 6, [2] = null, [3] = 42}
list_arrayVarrow::ListArray of type arrow::list(arrow::int64()), length 3, offset 0, null count 1r   r   s    r   test_arrays_stackrp    sF    =
57 7 7 <
,. . . . .r$   c                     t          | dd           t          | dd           t          | dd           t          | dd           t          | d	d
           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd           t          | dd            t          | d!d"           t          | d#d$           t          | d%d&           t          | d'd(           t          | d)d*           t          | d+d,           t          | d-d.           t          | d/d0           t          j        d1k    rEt          | d2d3           t          | d4d5           t          | d6d7           t          | d8d9           nDt          | d2d:           t          | d4d;           t          | d6d<           t          | d8d=           t          | d>d?           t          | d@dA           t          | dBdC           t          | dDdE           t          | dFdG           t          | dHdI           t          | dJdK           t          | dLdM           t          | dNdO           t          | dPdQ           t          | dRdS           t          | dTdU           d S )VNheap_null_arrayz4arrow::NullArray of length 2, offset 0, null count 2heap_int32_arrayrm  heap_int32_array_no_nullsz^arrow::Int32Array of length 4, offset 0, null count 0 = {[0] = -5, [1] = 6, [2] = 3, [3] = 42}heap_int32_array_sliced_1_9zarrow::Int32Array of length 9, offset 1, unknown null count = {[0] = 2, [1] = -3, [2] = 4, [3] = null, [4] = -5, [5] = 6, [6] = -7, [7] = 8, [8] = null}heap_int32_array_sliced_2_6zzarrow::Int32Array of length 6, offset 2, unknown null count = {[0] = -3, [1] = 4, [2] = null, [3] = -5, [4] = 6, [5] = -7}heap_int32_array_sliced_8_4zharrow::Int32Array of length 4, offset 8, unknown null count = {[0] = 8, [1] = null, [2] = -9, [3] = -10}heap_int32_array_sliced_emptyz;arrow::Int32Array of length 0, offset 6, unknown null countheap_double_arrayzQarrow::DoubleArray of length 2, offset 0, null count 1 = {[0] = -1.5, [1] = null}heap_float16_arrayzSarrow::HalfFloatArray of length 2, offset 0, null count 0 = {[0] = 0.0, [1] = -1.5}heap_bool_arraya!  arrow::BooleanArray of length 18, offset 0, null count 6 = {[0] = false, [1] = false, [2] = true, [3] = true, [4] = null, [5] = null, [6] = false, [7] = false, [8] = true, [9] = true, [10] = null, [11] = null, [12] = false, [13] = false, [14] = true, [15] = true, [16] = null, [17] = null}heap_bool_array_sliced_1_9zarrow::BooleanArray of length 9, offset 1, unknown null count = {[0] = false, [1] = true, [2] = true, [3] = null, [4] = null, [5] = false, [6] = false, [7] = true, [8] = true}heap_bool_array_sliced_2_6zarrow::BooleanArray of length 6, offset 2, unknown null count = {[0] = true, [1] = true, [2] = null, [3] = null, [4] = false, [5] = false}heap_bool_array_sliced_emptyz=arrow::BooleanArray of length 0, offset 6, unknown null countheap_date32_arrayzarrow::Date32Array of length 6, offset 0, null count 1 = {[0] = 0d [1970-01-01], [1] = null, [2] = 18336d [2020-03-15], [3] = -9004d [1945-05-08], [4] = -719162d [0001-01-01], [5] = -719163d [year <= 0]}heap_date64_arrayzarrow::Date64Array of length 5, offset 0, null count 0 = {[0] = 1584230400000ms [2020-03-15], [1] = -777945600000ms [1945-05-08], [2] = -62135596800000ms [0001-01-01], [3] = -62135683200000ms [year <= 0], [4] = 123ms [non-multiple of 86400000]}heap_time32_array_szarrow::Time32Array of type arrow::time32(arrow::TimeUnit::SECOND), length 3, offset 0, null count 1 = {[0] = null, [1] = -123s, [2] = 456s}heap_time32_array_mszarrow::Time32Array of type arrow::time32(arrow::TimeUnit::MILLI), length 3, offset 0, null count 1 = {[0] = null, [1] = -123ms, [2] = 456ms}heap_time64_array_uszarrow::Time64Array of type arrow::time64(arrow::TimeUnit::MICRO), length 3, offset 0, null count 1 = {[0] = null, [1] = -123us, [2] = 456us}heap_time64_array_nszarrow::Time64Array of type arrow::time64(arrow::TimeUnit::NANO), length 3, offset 0, null count 1 = {[0] = null, [1] = -123ns, [2] = 456ns}heap_month_interval_arrayzearrow::MonthIntervalArray of length 3, offset 0, null count 1 = {[0] = 123M, [1] = -456M, [2] = null}heap_day_time_interval_arrayz^arrow::DayTimeIntervalArray of length 2, offset 0, null count 1 = {[0] = 1d-600ms, [1] = null}"heap_month_day_nano_interval_arrayzharrow::MonthDayNanoIntervalArray of length 2, offset 0, null count 1 = {[0] = 1M-600d5000ns, [1] = null}heap_duration_array_szarrow::DurationArray of type arrow::duration(arrow::TimeUnit::SECOND), length 2, offset 0, null count 1 = {[0] = null, [1] = -1234567890123456789s}heap_duration_array_nszarrow::DurationArray of type arrow::duration(arrow::TimeUnit::NANO), length 2, offset 0, null count 1 = {[0] = null, [1] = -1234567890123456789ns}l        heap_timestamp_array_szarrow::TimestampArray of type arrow::timestamp(arrow::TimeUnit::SECOND), length 4, offset 0, null count 1 = {[0] = null, [1] = 0s [1970-01-01 00:00:00], [2] = -2203932304s [1900-02-28 12:34:56], [3] = 63730281600s [3989-07-14 00:00:00]}heap_timestamp_array_mszarrow::TimestampArray of type arrow::timestamp(arrow::TimeUnit::MILLI), length 3, offset 0, null count 1 = {[0] = null, [1] = -2203932303877ms [1900-02-28 12:34:56.123], [2] = 63730281600789ms [3989-07-14 00:00:00.789]}heap_timestamp_array_uszarrow::TimestampArray of type arrow::timestamp(arrow::TimeUnit::MICRO), length 3, offset 0, null count 1 = {[0] = null, [1] = -2203932303345679us [1900-02-28 12:34:56.654321], [2] = 63730281600456789us [3989-07-14 00:00:00.456789]}heap_timestamp_array_nszarrow::TimestampArray of type arrow::timestamp(arrow::TimeUnit::NANO), length 2, offset 0, null count 1 = {[0] = null, [1] = -2203932303012345679ns [1900-02-28 12:34:56.987654321]}zarrow::TimestampArray of type arrow::timestamp(arrow::TimeUnit::SECOND), length 4, offset 0, null count 1 = {[0] = null, [1] = 0s [1970-01-01 00:00:00], [2] = -2203932304s [too large to represent], [3] = 63730281600s [too large to represent]}zarrow::TimestampArray of type arrow::timestamp(arrow::TimeUnit::MILLI), length 3, offset 0, null count 1 = {[0] = null, [1] = -2203932303877ms [too large to represent], [2] = 63730281600789ms [too large to represent]}zarrow::TimestampArray of type arrow::timestamp(arrow::TimeUnit::MICRO), length 3, offset 0, null count 1 = {[0] = null, [1] = -2203932303345679us [too large to represent], [2] = 63730281600456789us [too large to represent]}zarrow::TimestampArray of type arrow::timestamp(arrow::TimeUnit::NANO), length 2, offset 0, null count 1 = {[0] = null, [1] = -2203932303012345679ns [too large to represent]}heap_decimal128_arrayzarrow::Decimal128Array of type arrow::decimal128(30, 6), length 3, offset 0, null count 1 = {[0] = null, [1] = -1234567890123456789.012345, [2] = 1234567890123456789.012345}heap_decimal256_arrayzarrow::Decimal256Array of type arrow::decimal256(50, 6), length 2, offset 0, null count 1 = {[0] = null, [1] = -123456789012345678901234567890123456789.012345}heap_decimal128_array_slicedzarrow::Decimal128Array of type arrow::decimal128(30, 6), length 1, offset 1, unknown null count = {[0] = -1234567890123456789.012345}heap_fixed_size_binary_arrayzarrow::FixedSizeBinaryArray of type arrow::fixed_size_binary(3), length 3, offset 0, null count 1 = {[0] = null, [1] = "abc", [2] = "\000\037\377"}'heap_fixed_size_binary_array_zero_widthzzarrow::FixedSizeBinaryArray of type arrow::fixed_size_binary(0), length 2, offset 0, null count 1 = {[0] = null, [1] = ""}#heap_fixed_size_binary_array_slicedzwarrow::FixedSizeBinaryArray of type arrow::fixed_size_binary(3), length 1, offset 1, unknown null count = {[0] = "abc"}heap_binary_arrayziarrow::BinaryArray of length 3, offset 0, null count 1 = {[0] = null, [1] = "abcd", [2] = "\000\037\377"}heap_large_binary_arrayznarrow::LargeBinaryArray of length 3, offset 0, null count 1 = {[0] = null, [1] = "abcd", [2] = "\000\037\377"}heap_string_arrayuq   arrow::StringArray of length 3, offset 0, null count 1 = {[0] = null, [1] = "héhé", [2] = "invalid \\xff char"}heap_large_string_arrayuv   arrow::LargeStringArray of length 3, offset 0, null count 1 = {[0] = null, [1] = "héhé", [2] = "invalid \\xff char"}heap_binary_array_slicedzMarrow::BinaryArray of length 1, offset 1, unknown null count = {[0] = "abcd"}heap_list_arrayro  )r   rA   maxsizer   s    r   test_arrays_heapr     s   $>@ @ @
 %
46 6 6 .
13 3 3 0
*, , ,
 0
GI I I 0
57 7 7 2EG G G &
#% % % '
"$ $ $ $
?A A A /
=? ? ?
 /
  
 1GI I I
 &
') ) ) &
35 5 5 (
02 2 2
 )
24 4 4
 )
24 4 4
 )
24 4 4
 .
02 2 2 1
') ) ) 7
<> > > *
46 6 6
 +
57 7 7
 {U/9	; 	; 	; 	0A	C 	C 	C 	0G	I 	I 	I 	0M	O 	O 	O 	O 	/<	> 	> 	> 	0@	B 	B 	B 	0C	E 	E 	E 	0F	H 	H 	H *
-/ / / *
BD D D 1
.0 0 0 1
;= = =
 <
FH H H 8
CE E E &
<> > > ,
<> > > &
DF F F ,
DF F F -
   $
,. . . . .r$   c                 l    t          | dd           t          | dd           t          | dd           d S )Nschema_emptyzarrow::Schema with 0 fieldsschema_non_emptyzRarrow::Schema with 2 fields = {["ints"] = arrow::int8(), ["strs"] = arrow::utf8()}schema_with_metadatazgarrow::Schema with 2 fields and 2 metadata items = {["ints"] = arrow::int8(), ["strs"] = arrow::utf8()}r   r   s    r   test_schemar    sg    I~13 3 3%
%' ' ' )
@B B B B Br$   c                 (    t          | dd           d S )Nchunked_arrayzarrow::ChunkedArray of type arrow::int32(), length 5, null count 1 with 2 chunks = {[0] = length 2, offset 0, null count 0, [1] = length 3, offset 0, null count 1}r   r   s    r   test_chunked_arrayr    s(    ?
35 5 5 5 5r$   c                     d}d}| d| }t          | d|           t          | d|           | d| }t          | d|           d S )Nz)arrow::RecordBatch with 2 columns, 3 rowsz{["ints"] = arrow::ArrayData of type arrow::int32(), length 3, offset 0, null count 0 = {[0] = 1, [1] = 2, [2] = 3}, ["strs"] = arrow::ArrayData of type arrow::utf8(), length 3, offset 0, null count 1 = {[0] = "abc", [1] = null, [2] = "def"}}z = batchzbatch.get()z, 3 metadata items = batch_with_metadatar   )r   expected_prefixexpected_suffixr   s       r   test_record_batchr    sx    AO	2  "77o77H Iw111I}h777!IIIIHI4h?????r$   c                 N    d}t          | d|           t          | d|           d S )Na  arrow::Table with 2 columns, 5 rows = {["ints"] = arrow::ChunkedArray of type arrow::int32(), length 5, null count 0 with 2 chunks = {[0] = length 3, offset 0, null count 0, [1] = length 2, offset 0, null count 0}, ["strs"] = arrow::ChunkedArray of type arrow::utf8(), length 5, null count 1 with 3 chunks = {[0] = length 2, offset 0, null count 1, [1] = length 1, offset 0, null count 0, [2] = length 2, offset 0, null count 0}}tableztable.get()r   )r   expected_tables     r   
test_tabler    s8    		3  Iw777I}n=====r$   c                 b   t          | dd           t          | dd           t          | dt          j        d                     t          | dt          j        d                     t          | d	t          j        d
                     t          | dt          j        d                     d S )Nempty_datumzarrow::Datum (empty)scalar_datumz8arrow::Datum of value arrow::BooleanScalar of null valuearray_datumz0^arrow::Datum of value arrow::ArrayData of type chunked_array_datumz3^arrow::Datum of value arrow::ChunkedArray of type batch_datumzA^arrow::Datum of value arrow::RecordBatch with 2 columns, 3 rows table_datumz;^arrow::Datum of value arrow::Table with 2 columns, 5 rows r]  r   s    r   
test_datumr  (  s    Y/EFFF>BD D D =

FGGI I I (

IJJL L L =

 . 	/ 	/0 0 0 =

 . 	/ 	/0 0 0 0 0r$   )6	functoolsr   r	   rZ   r    r   rA   r&   pyarrowr|   markr   
pytestmarkr"   dirnameabspath__file__herer
   r   rH   r,   r   r   r   r#   r)   r-   r/   fixturer   r   r   r   r   r   r   r   r   r   r   r   r  r  r_  rg  rj  rp  r  r  r  r  r  r  r(   r$   r   <module>r     sB  $        				 				      



      [_
	wrwx0011 jnn/00 >gll4!<==  fo           / / /
, , ,
[ [ [ [ [ [ [ [| i     !  i     ! ,, , ,
  
  * * *: : :&	G 	G 	G? ? ?9 9 9:O O OY< Y< Y<x#< #< #<LD D D< < <
AN AN ANH, , ,.F F F. . .j. j. j.Z
B 
B 
B5 5 5@ @ @(> > >$0 0 0 0 0r$   