
    g                        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                  j                  ej                  j                  e            Zej$                  j'                  d      xs ej                  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( Z5y))    )	lru_cacheNARROW_GDB_SCRIPTz../../../cpp/gdb_arrow.pygdbz--nxc                  d    i } dD ]  }	 t         j                  |   | |<    | S # t        $ r Y )w xY w)N)PATHLD_LIBRARY_PATH)osenvironKeyError)envvars     K/var/www/openai/venv/lib/python3.12/site-packages/pyarrow/tests/test_gdb.pyenvironment_for_gdbr   *   sB    
C*	zz#CH +
 J  		s   #	//c                      	 t        j                  t        dgz   t               dt         j                  t         j                  t         j
                        } | j                  dk(  S # t        $ r Y yw xY w)Nz	--versionr   )r   bufsizestdinstdoutstderrF)
subprocessrungdb_commandr   PIPESTDOUTFileNotFoundError
returncode)procs    r   is_gdb_availabler   4   sd    	 ~~k[M9"5"7$.OO%/__%/%6%6	8 ??a  s   AA& &	A21A2c                  B    t        j                  d      } | J d       | S )Npython3z Couldn't find python3 executable)shutilwhich)paths    r   python_executabler#   C   s'    <<	"D???K    c                  D    t               st        j                  d       y y )Nzgdb command unavailable)r   pytestskip r$   r   skip_if_gdb_unavailabler)   J   s    -. r$   c                  v    t         j                  j                  t              st	        j
                  d       y y )Nzgdb script not found)r	   r"   exists
gdb_scriptr&   r'   r(   r$   r   skip_if_gdb_script_unavailabler-   O   s$    77>>*%*+ &r$   c                   D    e Zd ZdZdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)
GdbSessionNTc                     t               }|j                  |       t        j                  t        t        |      z   |dt        j                  t        j                        | _        g | _        d| _	        y )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   sX    %'s$$[4:%=)0!+5??,6OO=	  #r$   c                    | j                   j                  d      sR| j                  j                         7| j                  j                  j                  d      }| j                  rQt        j                  j                  j                  |       t        j                  j                  j                          |j                  d      \  }}}|rK| j                  j                  | j                          | j                  j                  ||z          || _         n|dk(  sJ | xj                   |z  c_         | j                   j                  d      s| j                  j                         7| j                  j                         t        d      dj                  | j                        j!                  d      }g | _        d| _         |S )zW
        Record output until the gdb prompt displays.  Return recorded output.
        s   (gdb) i      
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   sc   
 ((33I>yy~~'II$$))$/E||

!!''.

!!'')$)$4$4U$;!E3	  ''(=(=>  ''4(1%|#|%%2% ((33I>yy~~' 99>>'?@@hht''(//8 #
r$   c                 x   |j                  d      dz   }| j                  rQt        j                  j                  j                  |       t        j                  j                  j                          | j                  j                  j                  |       | j                  j                  j                          y )Nr<   r;   )	encoder@   rA   r   rB   rC   rD   r   r   r6   lines     r   issue_commandzGdbSession.issue_command   st    {{7#e+<<JJ##D)JJ##%		d#		r$   c                 D    | j                  |       | j                         S N)rS   rN   rQ   s     r   run_commandzGdbSession.run_command   s    4 $$&&r$   c                     | j                  d|       }t        j                  dd|      \  }}|dk(  sJ |       |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   sM     D6{+r3/QAvsvyy{r$   c                    | j                  d      }dt        j                  |      z   dz   }t        j                  ||      }|t	        j
                  d|        t        |d         }| j                  d|       }d| |v sJ y)	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IIc39KK>ykJK!I		{34YK C'''r$   c                 $   | j                   | j                   j                  j                          | j                   j                  j                          | j                   j	                          | j                   j                          d | _         y y rU   )r   r   closer   killwaitr6   s    r   rH   zGdbSession.join   s^    99 IIOO!!#II""$IINNIINNDI !r$   c                 $    | j                          y 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   s4    DG	$8 '("r$   r/   session)scopec               #   D  K   t                t        dt                     } 	 | j                          | j	                  d       | j	                  d       | j	                  d       | j	                  d       |  | j                          y # | j                          w xY w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      sx     
T,.
/C	)*45-.+,	

s   B AB :B BB c                    dt         j                  j                  vrt        j                  d       t                | j                  dt                t        j                  dk(  rdnd}t        j                  j                  |      }|r| j                  d| d|        d	}| j                  d
| d      }d|v sd|v sJ |       | 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;<"$OOgj\*+ \\W46:KLzz~~l+H 	(<.(<=KD
//HTF!,
-C#s*$+'*+ %./Jr$   c                 V    | j                  d      }|j                  d      sJ |       y )Nzshow versionz	GNU gdb ()rV   r=   )r   rM   s     r   test_gdb_sessionr      s'    
//.
)C>>+&++&r$   c                 4    | j                  d      }|dk(  sJ y )Nz42 + 143)r_   )r   ss     r   test_gdb_arrowr      s    h'A99r$   c                     | j                  |      }t        |t        j                        r|j	                  |      sJ |       y||k(  sJ y)z/
    Check printing a stack-located value.
    N)r_   
isinstancerZ   Patternmatchr   r]   expectedr   s       r   check_stack_reprr      sC     	A(BJJ'~~a #!# H}}r$   c                 d    | j                  d|       }||k7  r|j                  d|       sJ yy)zA
    Check printing a heap-located value, given its address.
    *rz   N)r_   endswithr   s       r   check_heap_reprr      s<     	!D6
#AH}zzAhZ.))) r$   c                     t        | dd       t        | dd       t        | dd       t        | dd       t        | d	d
       t        | dd       y )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      sg    Y-BCYAC(	89
 Y-EF>HJ (	9:r$   c                 l    t        | dd       t        | dd       t        | dd       t        | dd       y )	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     sF    Y9;Y@B)HJ Y 0EGr$   c                 8    t        | dd       t        | dd       y )Nheap_bufferr   zheap_buffer_mutable.get()z'arrow::Buffer of size 3, mutable, "abc"r   r   s    r   test_buffer_heapr     s"    I}?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       y )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Y 0)$q13Y 0*4&24Y 702Y 6.tfA68Y 6/vQ793DY 13IJY 0)$q13Y 0*4&24Y 702Y 6.tfA68Y 6/vQ79r$   c                 8    t        | dd       t        | dd       y )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   ;  s'    I579#
M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       y )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  sY   Y_=Y-?@Y/@AY/@AY=?Y<>Y<>Y;=Y 2@B/BD Y 3?A/AC Y 813Y 5.0Y >79Y 1?AY 2=? Y 1/1Y 102 Y/@AY?Y 35LMY 35JKY 835 Y24Y 1=?Y 6BD&GI $FH Y 3)+=
AC
 &
!
 %
! (IK &H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       y )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     s    I/AI/1CDI2:<4AC I5.0 I/13I5<>I:AC?GI %
AC
 #IK #
:<r$   c                 8    t        | dd       t        | dd       y )N	int_field$arrow::field("ints", arrow::int64())float_fieldz8arrow::field("floats", arrow::float32(), nullable=false)r   r   s    r   test_fields_stackr    s"    Y;==BDr$   c                     t        | dd       y )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       y )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Y9;Y 29;Y57Y68YGIYHJY 3CEY79Y79 Y8:Y 0:<Y 0;=Y 0<>Y 2=? Y 3;=Y 4=?Y 4>@Y 4?AY 6?A '>@ (AC (AC (CE *@B *AC +DF +DF +FH -CE Y 7>@Y <?AY :FHY ?AC3@B 89; YDFY 48:YMOY 48: +GI 4KM 4LN 4
$& 4
$&
 +GI 4
#%
 4
#%
 4
$&
 4
$& '+- .46 (13 &46 (>@ ,9; '+- .46 (13 '79 0EG -<> -=? 2GI =


/	12 %
 =
JL %KM &
JL +
 +
JL 0
AC
 ?
HJ '
=? (
02 -rzz(0)* '
02 ,bjj(/)*
 %
$&
 *LNr$   c                     t        | dd       t        | dd       t        | dd       t        | dd       t        | d	d
       t        | dd       y )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    ss    I13FGI18:+KM +
#% $
FH )
*,r$   c                     t        | dd       y )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r$   c                 8    t        | dd       t        | dd       y )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    s(    =
5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                  d1kD  r5t        | d2d3       t        | d4d5       t        | d6d7       t        | d8d9       n4t        | 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       y )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 .
13 0
*,
 0
GI 0
57 2EG &
#% '
"$ $
?A /
=?
 /

 1GI
 &
') &
35 (
02
 )
24
 )
24
 )
24
 .
02 1
') 7
<> *
46
 +
57
 {{U/9	; 	0A	C 	0G	I 	0M	O 	/<	> 	0@	B 	0C	E 	0F	H *
-/ *
BD 1
.0 1
;=
 <
FH 8
CE &
<> ,
<> &
DF ,
DF -
 $
,.r$   c                 R    t        | dd       t        | dd       t        | dd       y )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    s;    I~13%
%' )
@Br$   c                     t        | dd       y )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5r$   c                 v    d}d}| d| }t        | d|       t        | d|       | d| }t        | d|       y )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    s_    AO	2  ""#o%67H Iw1I}h7!""77HIHI4h?r$   c                 <    d}t        | d|       t        | d|       y )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    s&    		3  Iw7I}n=r$   c                 8   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             y )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>BD =


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


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


 . 	/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     s  $   	 	   
   [[__
	wwrwwx01 jjnn/0 >ggll4!<=  fo      /
,
[ [| i  ! i  !,,

*:&	G?9:OY<x#<LD<
ANH,.F.j.Z
B5@(>$0r$   