You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Sean Wu <sh...@gmail.com> on 2022/09/28 07:32:57 UTC

NullPointer Exception when using Cross Collection Join

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!

Re: NullPointer Exception when using Cross Collection Join

Posted by Joel Bernstein <jo...@gmail.com>.
Can you share the stack trace?

Also in the Solr log there will be a call to the /export handler. Can you
get that from the log?

Then we can isolate the call to the export handler and see if we can
reproduce it.

Joel Bernstein
http://joelsolr.blogspot.com/


On Thu, Sep 29, 2022 at 3:01 PM Mikhail Khludnev <mk...@apache.org> wrote:

> Hi, Sean.
> It's not clear if it can be reproduced with bare solr dstro install,
> indexing a few docs and querying it; or it's something about
> hacking/customising it as a library?
>
> On Thu, Sep 29, 2022 at 7:42 PM Sean Wu <sh...@gmail.com> wrote:
>
> > 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!
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: NullPointer Exception when using Cross Collection Join

Posted by Mikhail Khludnev <mk...@apache.org>.
Hi, Sean.
It's not clear if it can be reproduced with bare solr dstro install,
indexing a few docs and querying it; or it's something about
hacking/customising it as a library?

On Thu, Sep 29, 2022 at 7:42 PM Sean Wu <sh...@gmail.com> wrote:

> 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!
>


-- 
Sincerely yours
Mikhail Khludnev