Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-2666

Wrong predicate when joining with a mapped tuple

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Optional Optional
    • 8.19.0.Final
    • 8.17.0.Final
    • optaplanner-core
    • None

      In an obscure constraint stream such as the following, the joiner may theoretically silently fail to match:

      .forEach(Something.class)
      .groupBy(something -> somethingElse)
      .join(forEach(Something.class)
          .map(something -> somethingElse),
          Joiners.equal())
      

      There is no reproducer for this situation, nor can there be a test. As it turns out, during beta indexing, Drools does not use the predicate, only the index. However, if Drools did the same thing as it does for alpha indexing (there is a threshold below which the predicate is used instead of the index), the bug would show up.

      Therefore I will provide the fix without a test. (I only discovered the issue by going through the code manually, looking for something completely different.)

            lpetrovi@redhat.com Lukáš Petrovický (Inactive)
            lpetrovi@redhat.com Lukáš Petrovický (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: