File tree 2 files changed +7
-5
lines changed
main/java/org/opensearch/search/aggregations/support
test/java/org/opensearch/search/aggregations/support
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -324,7 +324,8 @@ public boolean advanceExact(int doc) throws IOException {
324
324
325
325
@ Override
326
326
public int docValueCount () {
327
- return values .docValueCount ();
327
+ // If we don't have ordinals, then we just have the missing value
328
+ return hasOrds ? values .docValueCount () : 1 ;
328
329
}
329
330
330
331
@ Override
@@ -359,7 +360,8 @@ public long getValueCount() {
359
360
360
361
@ Override
361
362
public int docValueCount () {
362
- return Math .max (1 , values .docValueCount ());
363
+ // If we don't have ordinals, then we just have the missing value
364
+ return hasOrds ? values .docValueCount () : 1 ;
363
365
}
364
366
365
367
@ Override
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ public long nextOrd() {
152
152
if (i < ords [doc ].length ) {
153
153
return ords [doc ][i ++];
154
154
} else {
155
- return NO_MORE_DOCS ;
155
+ throw new IllegalStateException () ;
156
156
}
157
157
}
158
158
@@ -175,13 +175,13 @@ public int docValueCount() {
175
175
for (int i = 0 ; i < numDocs ; ++i ) {
176
176
assertTrue (withMissingReplaced .advanceExact (i ));
177
177
if (ords [i ].length > 0 ) {
178
+ assertEquals (ords [i ].length , withMissingReplaced .docValueCount ());
178
179
for (int ord : ords [i ]) {
179
180
assertEquals (values [ord ], withMissingReplaced .lookupOrd (withMissingReplaced .nextOrd ()));
180
181
}
181
- assertEquals (SortedSetDocValues .NO_MORE_DOCS , withMissingReplaced .nextOrd ());
182
182
} else {
183
+ assertEquals (1 , withMissingReplaced .docValueCount ());
183
184
assertEquals (missing , withMissingReplaced .lookupOrd (withMissingReplaced .nextOrd ()));
184
- assertEquals (SortedSetDocValues .NO_MORE_DOCS , withMissingReplaced .nextOrd ());
185
185
}
186
186
}
187
187
}
You can’t perform that action at this time.
0 commit comments