File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
main/java/org/opensearch/search/aggregations/support
test/java/org/opensearch/search/aggregations/support Expand file tree Collapse file tree 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 {
324324
325325 @ Override
326326 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 ;
328329 }
329330
330331 @ Override
@@ -359,7 +360,8 @@ public long getValueCount() {
359360
360361 @ Override
361362 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 ;
363365 }
364366
365367 @ Override
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ public long nextOrd() {
152152 if (i < ords [doc ].length ) {
153153 return ords [doc ][i ++];
154154 } else {
155- return NO_MORE_DOCS ;
155+ throw new IllegalStateException () ;
156156 }
157157 }
158158
@@ -175,13 +175,13 @@ public int docValueCount() {
175175 for (int i = 0 ; i < numDocs ; ++i ) {
176176 assertTrue (withMissingReplaced .advanceExact (i ));
177177 if (ords [i ].length > 0 ) {
178+ assertEquals (ords [i ].length , withMissingReplaced .docValueCount ());
178179 for (int ord : ords [i ]) {
179180 assertEquals (values [ord ], withMissingReplaced .lookupOrd (withMissingReplaced .nextOrd ()));
180181 }
181- assertEquals (SortedSetDocValues .NO_MORE_DOCS , withMissingReplaced .nextOrd ());
182182 } else {
183+ assertEquals (1 , withMissingReplaced .docValueCount ());
183184 assertEquals (missing , withMissingReplaced .lookupOrd (withMissingReplaced .nextOrd ()));
184- assertEquals (SortedSetDocValues .NO_MORE_DOCS , withMissingReplaced .nextOrd ());
185185 }
186186 }
187187 }
You can’t perform that action at this time.
0 commit comments