@@ -330,9 +330,8 @@ mod tests {
330
330
assert_eq ! ( ret, expected_ret, "Negative i64 entry should be ignored!" ) ;
331
331
}
332
332
333
- #[ tokio:: test]
334
- async fn test_data_file_serialize_deserialize ( ) {
335
- let schema = Arc :: new (
333
+ fn schema ( ) -> Arc < Schema > {
334
+ Arc :: new (
336
335
Schema :: builder ( )
337
336
. with_fields ( vec ! [
338
337
Arc :: new( NestedField :: optional(
@@ -353,8 +352,11 @@ mod tests {
353
352
] )
354
353
. build ( )
355
354
. unwrap ( ) ,
356
- ) ;
357
- let data_files = vec ! [ DataFile {
355
+ )
356
+ }
357
+
358
+ fn data_files ( ) -> Vec < DataFile > {
359
+ vec ! [ DataFile {
358
360
content: DataContentType :: Data ,
359
361
file_path: "s3://testbucket/iceberg_data/iceberg_ctl/iceberg_db/iceberg_tbl/data/00000-7-45268d71-54eb-476c-b42c-942d880c04a1-00001.parquet" . to_string( ) ,
360
362
file_format: DataFileFormat :: Parquet ,
@@ -376,7 +378,13 @@ mod tests {
376
378
referenced_data_file: None ,
377
379
content_offset: None ,
378
380
content_size_in_bytes: None ,
379
- } ] ;
381
+ } ]
382
+ }
383
+
384
+ #[ tokio:: test]
385
+ async fn test_data_file_serialize_deserialize ( ) {
386
+ let schema = schema ( ) ;
387
+ let data_files = data_files ( ) ;
380
388
381
389
let mut buffer = Vec :: new ( ) ;
382
390
let _ = write_data_files_to_avro (
@@ -401,51 +409,8 @@ mod tests {
401
409
402
410
#[ tokio:: test]
403
411
async fn test_data_file_serialize_deserialize_v1_data_on_v2_reader ( ) {
404
- let schema = Arc :: new (
405
- Schema :: builder ( )
406
- . with_fields ( vec ! [
407
- Arc :: new( NestedField :: optional(
408
- 1 ,
409
- "v1" ,
410
- Type :: Primitive ( PrimitiveType :: Int ) ,
411
- ) ) ,
412
- Arc :: new( NestedField :: optional(
413
- 2 ,
414
- "v2" ,
415
- Type :: Primitive ( PrimitiveType :: String ) ,
416
- ) ) ,
417
- Arc :: new( NestedField :: optional(
418
- 3 ,
419
- "v3" ,
420
- Type :: Primitive ( PrimitiveType :: String ) ,
421
- ) ) ,
422
- ] )
423
- . build ( )
424
- . unwrap ( ) ,
425
- ) ;
426
- let data_files = vec ! [ DataFile {
427
- content: DataContentType :: Data ,
428
- file_path: "s3://testbucket/iceberg_data/iceberg_ctl/iceberg_db/iceberg_tbl/data/00000-7-45268d71-54eb-476c-b42c-942d880c04a1-00001.parquet" . to_string( ) ,
429
- file_format: DataFileFormat :: Parquet ,
430
- partition: Struct :: empty( ) ,
431
- record_count: 1 ,
432
- file_size_in_bytes: 875 ,
433
- column_sizes: HashMap :: from( [ ( 1 , 47 ) , ( 2 , 48 ) , ( 3 , 52 ) ] ) ,
434
- value_counts: HashMap :: from( [ ( 1 , 1 ) , ( 2 , 1 ) , ( 3 , 1 ) ] ) ,
435
- null_value_counts: HashMap :: from( [ ( 1 , 0 ) , ( 2 , 0 ) , ( 3 , 0 ) ] ) ,
436
- nan_value_counts: HashMap :: new( ) ,
437
- lower_bounds: HashMap :: from( [ ( 1 , Datum :: int( 1 ) ) , ( 2 , Datum :: string( "a" ) ) , ( 3 , Datum :: string( "AC/DC" ) ) ] ) ,
438
- upper_bounds: HashMap :: from( [ ( 1 , Datum :: int( 1 ) ) , ( 2 , Datum :: string( "a" ) ) , ( 3 , Datum :: string( "AC/DC" ) ) ] ) ,
439
- key_metadata: None ,
440
- split_offsets: vec![ 4 ] ,
441
- equality_ids: vec![ ] ,
442
- sort_order_id: Some ( 0 ) ,
443
- partition_spec_id: 0 ,
444
- first_row_id: None ,
445
- referenced_data_file: None ,
446
- content_offset: None ,
447
- content_size_in_bytes: None ,
448
- } ] ;
412
+ let schema = schema ( ) ;
413
+ let data_files = data_files ( ) ;
449
414
450
415
let mut buffer = Vec :: new ( ) ;
451
416
let _ = write_data_files_to_avro (
0 commit comments