Hi, Solr team.

I'm using Solr 9.0.0 and when I query with Cross Collection Join on
our own data. There is a NullPointer Exception.

Error line: 
solr-9.0.0/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java#803

DocIdSetIterator it = new BitSetIterator(bits, 0);

It seems like 'bits' is null and the constructor of BitSetIterator
throws a NullPointer Exception.


With deeper debugging, I found that the code assumes that the length
of 'sets'(bits) and 'leaves' are equal(As shown by code below).
However in my test, the last few elements of 'sets' could be null,
which caused a NullPointer Exception.

sets = (FixedBitSet[]) req.getContext().get("export");

List<LeafReaderContext> leaves =
req.getSearcher().getTopReaderContext().leaves();

SegmentIterator[] segmentIterators = new SegmentIterator[leaves.size()];
for (int i = 0; i < segmentIterators.length; i++) {
  SortQueue sortQueue = new SortQueue(sizes[i], sortDoc.copy());
  segmentIterators[i] =
      new SegmentIterator(bits[i], leaves.get(i), sortQueue, sortDoc.copy());
}


Then I tried to skip creating a BitSetIterator object if bits == null,
and it worked as expected. The query results were returned without
data missing.

But I still don't know if the Exception is expected or it is a bug.
Hope to get your response, thanks a lot!

Reply via email to