Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7810

false positive equality: distinctly diff join queries return equals()==true

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 6.6, 6.7, 7.0
    • None
    • None
    • New

    Description

      While working on SOLR-10583 I was getting some odd test failures that seemed to suggest we were getting false cache hits for Join queries that should have been unique.

      tracing thorugh the code, the problem seems to be the way TermsQuery implements equals(Object). This class takes in the fromQuery (used to identify set of documents we "join from") and uses it in the equals calculation – but the information about the join field is never passed directly to TermsQuery and the BytesRefs that are passed in can't be compared efficiently (AFAICT), so 2 completely diff calls to JoinUtils.createJoinQuery(...) can result in Query objects that think they are equal() even when they most certainly are not.

      At a brief glance, it appears that similar bugs exist in TermsIncludingScoreQuery (and possibly GlobalOrdinalsWithScoreQuery, but i didn't look into that class at all)

      Attachments

        1. LUCENE_7810.patch
          34 kB
          Martijn van Groningen
        2. LUCENE_7810.patch
          27 kB
          Martijn van Groningen
        3. LUCENE-7810.patch
          4 kB
          Chris M. Hostetter

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hossman Chris M. Hostetter
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: