Issue Details (XML | Word | Printable)

Key: NUCCORE-1002
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Vitaly Velikodny
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

InMemory query evaluation with a variable that has no possible values just returns rather than trying with "null" as the value

Created: 25/Feb/13 06:34 PM   Updated: 08/Mar/13 02:57 PM   Resolved: 26/Feb/13 02:45 PM
Component/s: Queries
Affects Version/s: 3.0.11, 3.1.4, 3.2.0.m3
Fix Version/s: 3.2.0.release

File Attachments: 1. Zip Archive datanucleus-test-sample-3.0.zip (9 kB)

Environment: windows 7, maven3, java version "1.7.0_09"

Datastore: MongoDB
Severity: Production


 Description  « Hide
1. There is collection in MongoDB with 2 collection fields - partsNeeded and poNumbers.

{ "_id" : ObjectId("512b9faf42c1b442fb94ee7f"), "requestType" : "maintenance", "subType" : { "poNumbers" : [ "12" ], "partsNeeded" : [ ] } }

{ "_id" : ObjectId("512b9fb042c1b442fb94ee80"), "requestType" : "maintenance", "subType" : { "poNumbers" : [ "12" ], "partsNeeded" : [ "abcd" ] } }

       
2. Trying to do search by the following filter:
  (
    (
       parts.contains(contains_param_0) && contains_param_0.matches(parameter_2)
     )
    ||
    numbers.contains(parameter_1)
   )

   parameter_1 = "^\Qabc\E.$" (String type)
   parameter_2 = "12" (String type)

Expected result: found two entity

Actual result: only one entity found

Possible cause:
   class: JavaQueryEvaluator
   method: evaluateBooleanExpression
   code fragment:

      if (vnse.getValues() == null || vnse.getValues().length == 0)
            {
                // No possible values for the variable so fails
                return Boolean.FALSE;
            }

So, as we have empty list we return Boolean.FALSE for first filter expression:
       parts.contains(contains_param_0) && contains_param_0.matches(parameter_2)
and ignore the second one after OR operator.

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 26/Feb/13 02:45 PM
SVN trunk works on that specific case (totally unrelated to MongoDB). TODO added to code for allowing generalised handling of variables (currently only likely to work with a single variable).