@@ -2030,3 +2030,24 @@ def test_construct_from_chunked_array_wrong_type(self):
20302030
20312031 with pytest .raises (ValueError ):
20322032 Pair .from_kwargs (x = x , y = y )
2033+
2034+
2035+ @pytest .mark .parametrize ("N" , [100_000 , 1_000_000 , 10_000_000 ])
2036+ @pytest .mark .benchmark (group = "from-pyarrow" )
2037+ def test_bench_from_pyarrow_matching_schema (benchmark , N ):
2038+ N = 1_000_000
2039+ x = pa .array (np .random .randint (low = - 1000 , high = 1000 , size = N ), type = pa .int64 ())
2040+ y = pa .array (np .random .randint (low = - 1000 , high = 1000 , size = N ), type = pa .int64 ())
2041+ table = pa .table ({"x" : x , "y" : y }, schema = Pair .schema )
2042+
2043+ benchmark (Pair .from_pyarrow , table )
2044+
2045+
2046+ @pytest .mark .parametrize ("N" , [100_000 , 1_000_000 , 10_000_000 ])
2047+ @pytest .mark .benchmark (group = "from-pyarrow" )
2048+ def test_bench_from_pyarrow_needs_cast (benchmark , N ):
2049+ x = pa .array (np .random .randint (low = - 1000 , high = 1000 , size = N ), type = pa .int32 ())
2050+ y = pa .array (np .random .randint (low = - 1000 , high = 1000 , size = N ), type = pa .int64 ())
2051+ table = pa .table ({"x" : x , "y" : y })
2052+
2053+ benchmark (Pair .from_pyarrow , table )
0 commit comments