@@ -66,3 +66,43 @@ func TestUtil_EstimateReadCountPerBatch(t *testing.T) {
66
66
_ , err = EstimateReadCountPerBatch (16 * 1024 * 1024 , schema )
67
67
assert .Error (t , err )
68
68
}
69
+
70
+ func TestUtil_EstimateReadCountPerBatch_InvalidBufferSize (t * testing.T ) {
71
+ schema := & schemapb.CollectionSchema {}
72
+ count , err := EstimateReadCountPerBatch (16 * 1024 * 1024 , schema )
73
+ assert .Error (t , err )
74
+ assert .Equal (t , int64 (0 ), count )
75
+ t .Logf ("err=%v" , err )
76
+
77
+ schema = & schemapb.CollectionSchema {
78
+ Fields : []* schemapb.FieldSchema {
79
+ {
80
+ FieldID : 100 ,
81
+ DataType : schemapb .DataType_Int64 ,
82
+ },
83
+ },
84
+ }
85
+ count , err = EstimateReadCountPerBatch (0 , schema )
86
+ assert .Error (t , err )
87
+ assert .Equal (t , int64 (0 ), count )
88
+ t .Logf ("err=%v" , err )
89
+ }
90
+
91
+ func TestUtil_EstimateReadCountPerBatch_LargeSchema (t * testing.T ) {
92
+ schema := & schemapb.CollectionSchema {}
93
+ for i := 0 ; i < 100 ; i ++ {
94
+ schema .Fields = append (schema .Fields , & schemapb.FieldSchema {
95
+ FieldID : int64 (i ),
96
+ DataType : schemapb .DataType_VarChar ,
97
+ TypeParams : []* commonpb.KeyValuePair {
98
+ {
99
+ Key : common .MaxLengthKey ,
100
+ Value : "10000000" ,
101
+ },
102
+ },
103
+ })
104
+ }
105
+ count , err := EstimateReadCountPerBatch (16 * 1024 * 1024 , schema )
106
+ assert .NoError (t , err )
107
+ assert .Equal (t , int64 (1 ), count )
108
+ }
0 commit comments