@@ -20,6 +20,7 @@ pub async fn create_context() -> Result<SessionContext> {
2020 Ok ( ctx)
2121}
2222
23+ #[ expect( clippy:: too_many_lines) ]
2324async fn create_test_table ( large_utf8 : bool , dict_encoded : bool ) -> Result < SessionContext > {
2425 let ctx = create_context ( ) . await ?;
2526
@@ -42,7 +43,7 @@ async fn create_test_table(large_utf8: bool, dict_encoded: bool) -> Result<Sessi
4243 if dict_encoded {
4344 json_data_type = DataType :: Dictionary ( DataType :: Int32 . into ( ) , json_data_type. into ( ) ) ;
4445 json_array = Arc :: new ( DictionaryArray :: < Int32Type > :: new (
45- Int32Array :: from_iter_values ( 0 ..( json_array. len ( ) as i32 ) ) ,
46+ Int32Array :: from_iter_values ( 0 ..( i32 :: try_from ( json_array. len ( ) ) . expect ( "fits in a i32" ) ) ) ,
4647 json_array,
4748 ) ) ;
4849 }
@@ -160,13 +161,23 @@ async fn create_test_table(large_utf8: bool, dict_encoded: bool) -> Result<Sessi
160161 ] ) ) ,
161162 vec ! [
162163 Arc :: new( DictionaryArray :: <UInt32Type >:: new(
163- UInt32Array :: from_iter_values( dict_data. iter( ) . enumerate( ) . map( |( id, _) | id as u32 ) ) ,
164+ UInt32Array :: from_iter_values(
165+ dict_data
166+ . iter( )
167+ . enumerate( )
168+ . map( |( id, _) | u32 :: try_from( id) . expect( "fits in a u32" ) ) ,
169+ ) ,
164170 Arc :: new( StringArray :: from(
165171 dict_data. iter( ) . map( |( json, _, _, _) | * json) . collect:: <Vec <_>>( ) ,
166172 ) ) ,
167173 ) ) ,
168174 Arc :: new( DictionaryArray :: <UInt8Type >:: new(
169- UInt8Array :: from_iter_values( dict_data. iter( ) . enumerate( ) . map( |( id, _) | id as u8 ) ) ,
175+ UInt8Array :: from_iter_values(
176+ dict_data
177+ . iter( )
178+ . enumerate( )
179+ . map( |( id, _) | u8 :: try_from( id) . expect( "fits in a u8" ) ) ,
180+ ) ,
170181 Arc :: new( LargeStringArray :: from(
171182 dict_data
172183 . iter( )
@@ -175,7 +186,12 @@ async fn create_test_table(large_utf8: bool, dict_encoded: bool) -> Result<Sessi
175186 ) ) ,
176187 ) ) ,
177188 Arc :: new( DictionaryArray :: <UInt8Type >:: new(
178- UInt8Array :: from_iter_values( dict_data. iter( ) . enumerate( ) . map( |( id, _) | id as u8 ) ) ,
189+ UInt8Array :: from_iter_values(
190+ dict_data
191+ . iter( )
192+ . enumerate( )
193+ . map( |( id, _) | u8 :: try_from( id) . expect( "fits in a u8" ) ) ,
194+ ) ,
179195 Arc :: new( StringViewArray :: from(
180196 dict_data
181197 . iter( )
@@ -184,9 +200,16 @@ async fn create_test_table(large_utf8: bool, dict_encoded: bool) -> Result<Sessi
184200 ) ) ,
185201 ) ) ,
186202 Arc :: new( DictionaryArray :: <Int64Type >:: new(
187- Int64Array :: from_iter_values( dict_data. iter( ) . enumerate( ) . map( |( id, _) | id as i64 ) ) ,
203+ Int64Array :: from_iter_values(
204+ dict_data
205+ . iter( )
206+ . enumerate( )
207+ . map( |( id, _) | i64 :: try_from( id) . expect( "fits in a i64" ) ) ,
208+ ) ,
188209 Arc :: new( UInt64Array :: from_iter_values(
189- dict_data. iter( ) . map( |( _, _, _, int_key) | * int_key as u64 ) ,
210+ dict_data
211+ . iter( )
212+ . map( |( _, _, _, int_key) | u64 :: try_from( * int_key) . expect( "not negative" ) ) ,
190213 ) ) ,
191214 ) ) ,
192215 ] ,
0 commit comments