@@ -56,13 +56,16 @@ void collectOnce(final Object value) {
5656 * This is an expensive check, that slows down downsampling significantly.
5757 * Given that index is sorted by tsid as primary key, this shouldn't really happen.
5858 */
59- boolean validate (FormattedDocValues docValues , int docId ) throws IOException {
60- if (docValues .advanceExact (docId )) {
61- int docValueCount = docValues .docValueCount ();
62- for (int i = 0 ; i < docValueCount ; i ++) {
63- var value = docValues .nextValue ();
64- if (value .equals (this .value ) == false ) {
65- assert false : "Dimension value changed without tsid change [" + value + "] != [" + this .value + "]" ;
59+ boolean validate (FormattedDocValues docValues , IntArrayList buffer ) throws IOException {
60+ for (int i = 0 ; i < buffer .size (); i ++) {
61+ int docId = buffer .get (i );
62+ if (docValues .advanceExact (docId )) {
63+ int docValueCount = docValues .docValueCount ();
64+ for (int j = 0 ; j < docValueCount ; j ++) {
65+ var value = docValues .nextValue ();
66+ if (value .equals (this .value ) == false ) {
67+ assert false : "Dimension value changed without tsid change [" + value + "] != [" + this .value + "]" ;
68+ }
6669 }
6770 }
6871 }
@@ -84,6 +87,7 @@ public boolean isEmpty() {
8487 @ Override
8588 public void collect (FormattedDocValues docValues , IntArrayList buffer ) throws IOException {
8689 if (dimension .isEmpty == false ) {
90+ assert dimension .validate (docValues , buffer );
8791 return ;
8892 }
8993
0 commit comments