@@ -55,7 +55,7 @@ impl From<u32> for Dimension {
55
55
}
56
56
57
57
/// A trait for anything that can generate arrays of data
58
- pub trait ArrayGenerator : Send + Sync {
58
+ pub trait ArrayGenerator : Send + Sync + std :: fmt :: Debug {
59
59
/// Generate an array of the given length
60
60
///
61
61
/// # Arguments
@@ -92,6 +92,7 @@ pub trait ArrayGenerator: Send + Sync {
92
92
fn element_size_bytes ( & self ) -> Option < ByteCount > ;
93
93
}
94
94
95
+ #[ derive( Debug ) ]
95
96
pub struct CycleNullGenerator {
96
97
generator : Box < dyn ArrayGenerator > ,
97
98
validity : Vec < bool > ,
@@ -139,6 +140,7 @@ impl ArrayGenerator for CycleNullGenerator {
139
140
}
140
141
}
141
142
143
+ #[ derive( Debug ) ]
142
144
pub struct MetadataGenerator {
143
145
generator : Box < dyn ArrayGenerator > ,
144
146
metadata : HashMap < String , String > ,
@@ -166,6 +168,7 @@ impl ArrayGenerator for MetadataGenerator {
166
168
}
167
169
}
168
170
171
+ #[ derive( Debug ) ]
169
172
pub struct NullGenerator {
170
173
generator : Box < dyn ArrayGenerator > ,
171
174
null_probability : f64 ,
@@ -245,6 +248,10 @@ impl ArrayGenerator for NullGenerator {
245
248
}
246
249
}
247
250
251
+ fn metadata ( & self ) -> Option < HashMap < String , String > > {
252
+ self . generator . metadata ( )
253
+ }
254
+
248
255
fn data_type ( & self ) -> & DataType {
249
256
self . generator . data_type ( )
250
257
}
@@ -349,6 +356,23 @@ where
349
356
element_size_bytes : Option < ByteCount > ,
350
357
}
351
358
359
+ impl < T , ArrayType , F : FnMut ( & mut rand_xoshiro:: Xoshiro256PlusPlus ) -> T > std:: fmt:: Debug
360
+ for FnGen < T , ArrayType , F >
361
+ where
362
+ T : Copy + Default ,
363
+ ArrayType : arrow_array:: Array + From < Vec < T > > ,
364
+ {
365
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
366
+ f. debug_struct ( "FnGen" )
367
+ . field ( "data_type" , & self . data_type )
368
+ . field ( "array_type" , & self . array_type )
369
+ . field ( "repeat" , & self . repeat )
370
+ . field ( "leftover_count" , & self . leftover_count )
371
+ . field ( "element_size_bytes" , & self . element_size_bytes )
372
+ . finish ( )
373
+ }
374
+ }
375
+
352
376
impl < T , ArrayType , F : FnMut ( & mut rand_xoshiro:: Xoshiro256PlusPlus ) -> T > FnGen < T , ArrayType , F >
353
377
where
354
378
T : Copy + Default ,
@@ -422,6 +446,7 @@ impl From<u64> for Seed {
422
446
}
423
447
}
424
448
449
+ #[ derive( Debug ) ]
425
450
pub struct CycleVectorGenerator {
426
451
underlying_gen : Box < dyn ArrayGenerator > ,
427
452
dimension : Dimension ,
@@ -470,7 +495,7 @@ impl ArrayGenerator for CycleVectorGenerator {
470
495
}
471
496
}
472
497
473
- #[ derive( Default ) ]
498
+ #[ derive( Debug , Default ) ]
474
499
pub struct PseudoUuidGenerator { }
475
500
476
501
impl ArrayGenerator for PseudoUuidGenerator {
@@ -497,7 +522,7 @@ impl ArrayGenerator for PseudoUuidGenerator {
497
522
}
498
523
}
499
524
500
- #[ derive( Default ) ]
525
+ #[ derive( Debug , Default ) ]
501
526
pub struct PseudoUuidHexGenerator { }
502
527
503
528
impl ArrayGenerator for PseudoUuidHexGenerator {
@@ -524,7 +549,7 @@ impl ArrayGenerator for PseudoUuidHexGenerator {
524
549
}
525
550
}
526
551
527
- #[ derive( Default ) ]
552
+ #[ derive( Debug , Default ) ]
528
553
pub struct RandomBooleanGenerator { }
529
554
530
555
impl ArrayGenerator for RandomBooleanGenerator {
@@ -558,6 +583,14 @@ pub struct RandomBytesGenerator<T: ArrowPrimitiveType + Send + Sync> {
558
583
data_type : DataType ,
559
584
}
560
585
586
+ impl < T : ArrowPrimitiveType + Send + Sync > std:: fmt:: Debug for RandomBytesGenerator < T > {
587
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
588
+ f. debug_struct ( "RandomBytesGenerator" )
589
+ . field ( "data_type" , & self . data_type )
590
+ . finish ( )
591
+ }
592
+ }
593
+
561
594
impl < T : ArrowPrimitiveType + Send + Sync > RandomBytesGenerator < T > {
562
595
fn new ( data_type : DataType ) -> Self {
563
596
Self {
@@ -597,6 +630,7 @@ impl<T: ArrowPrimitiveType + Send + Sync> ArrayGenerator for RandomBytesGenerato
597
630
598
631
// This is pretty much the same thing as RandomBinaryGenerator but we can't use that
599
632
// because there is no ArrowPrimitiveType for FixedSizeBinary
633
+ #[ derive( Debug ) ]
600
634
pub struct RandomFixedSizeBinaryGenerator {
601
635
data_type : DataType ,
602
636
size : i32 ,
@@ -636,6 +670,7 @@ impl ArrayGenerator for RandomFixedSizeBinaryGenerator {
636
670
}
637
671
}
638
672
673
+ #[ derive( Debug ) ]
639
674
pub struct RandomIntervalGenerator {
640
675
unit : IntervalUnit ,
641
676
data_type : DataType ,
@@ -688,6 +723,7 @@ impl ArrayGenerator for RandomIntervalGenerator {
688
723
Some ( ByteCount :: from ( 12 ) )
689
724
}
690
725
}
726
+ #[ derive( Debug ) ]
691
727
pub struct RandomBinaryGenerator {
692
728
bytes_per_element : ByteCount ,
693
729
scale_to_utf8 : bool ,
@@ -776,6 +812,7 @@ impl ArrayGenerator for RandomBinaryGenerator {
776
812
}
777
813
}
778
814
815
+ #[ derive( Debug ) ]
779
816
pub struct VariableRandomBinaryGenerator {
780
817
lengths_gen : Box < dyn ArrayGenerator > ,
781
818
data_type : DataType ,
@@ -830,6 +867,18 @@ pub struct CycleBinaryGenerator<T: ByteArrayType> {
830
867
idx : usize ,
831
868
}
832
869
870
+ impl < T : ByteArrayType > std:: fmt:: Debug for CycleBinaryGenerator < T > {
871
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
872
+ f. debug_struct ( "CycleBinaryGenerator" )
873
+ . field ( "values" , & self . values )
874
+ . field ( "lengths" , & self . lengths )
875
+ . field ( "data_type" , & self . data_type )
876
+ . field ( "width" , & self . width )
877
+ . field ( "idx" , & self . idx )
878
+ . finish ( )
879
+ }
880
+ }
881
+
833
882
impl < T : ByteArrayType > CycleBinaryGenerator < T > {
834
883
pub fn from_strings ( values : & [ & str ] ) -> Self {
835
884
if values. is_empty ( ) {
@@ -905,6 +954,15 @@ pub struct FixedBinaryGenerator<T: ByteArrayType> {
905
954
array_type : PhantomData < T > ,
906
955
}
907
956
957
+ impl < T : ByteArrayType > std:: fmt:: Debug for FixedBinaryGenerator < T > {
958
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
959
+ f. debug_struct ( "FixedBinaryGenerator" )
960
+ . field ( "value" , & self . value )
961
+ . field ( "data_type" , & self . data_type )
962
+ . finish ( )
963
+ }
964
+ }
965
+
908
966
impl < T : ByteArrayType > FixedBinaryGenerator < T > {
909
967
pub fn new ( value : Vec < u8 > ) -> Self {
910
968
Self {
@@ -954,6 +1012,16 @@ pub struct DictionaryGenerator<K: ArrowDictionaryKeyType> {
954
1012
key_width : u64 ,
955
1013
}
956
1014
1015
+ impl < K : ArrowDictionaryKeyType > std:: fmt:: Debug for DictionaryGenerator < K > {
1016
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
1017
+ f. debug_struct ( "DictionaryGenerator" )
1018
+ . field ( "generator" , & self . generator )
1019
+ . field ( "data_type" , & self . data_type )
1020
+ . field ( "key_width" , & self . key_width )
1021
+ . finish ( )
1022
+ }
1023
+ }
1024
+
957
1025
impl < K : ArrowDictionaryKeyType > DictionaryGenerator < K > {
958
1026
fn new ( generator : Box < dyn ArrayGenerator > ) -> Self {
959
1027
let key_type = Box :: new ( K :: DATA_TYPE ) ;
@@ -993,6 +1061,7 @@ impl<K: ArrowDictionaryKeyType + Send + Sync> ArrayGenerator for DictionaryGener
993
1061
}
994
1062
}
995
1063
1064
+ #[ derive( Debug ) ]
996
1065
struct RandomListGenerator {
997
1066
field : Arc < Field > ,
998
1067
child_field : Arc < Field > ,
@@ -1069,6 +1138,7 @@ impl ArrayGenerator for RandomListGenerator {
1069
1138
}
1070
1139
}
1071
1140
1141
+ #[ derive( Debug ) ]
1072
1142
struct NullArrayGenerator { }
1073
1143
1074
1144
impl ArrayGenerator for NullArrayGenerator {
@@ -1089,6 +1159,7 @@ impl ArrayGenerator for NullArrayGenerator {
1089
1159
}
1090
1160
}
1091
1161
1162
+ #[ derive( Debug ) ]
1092
1163
struct RandomStructGenerator {
1093
1164
fields : Fields ,
1094
1165
data_type : DataType ,
0 commit comments