DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
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.

Vitaly Velikodny made changes - 25/Feb/13 06:44 PM
Field Original Value New Value
Attachment datanucleus-test-sample-3.0.zip [ 11910 ]
Andy Jefferson made changes - 26/Feb/13 02:43 PM
Project DataNucleus Store MongoDB [ 10310 ] DataNucleus Core [ 10143 ]
Key NUCMONGODB-117 NUCCORE-1002
Affects Version/s 3.2.0.m3 [ 11832 ]
Affects Version/s 3.1.4 [ 11800 ]
Affects Version/s 3.0.11 [ 11534 ]
Affects Version/s 3.2.0.m3 [ 11841 ]
Component/s Queries [ 10154 ]
Component/s Query [ 10290 ]
Andy Jefferson made changes - 26/Feb/13 02:44 PM
Summary Searching fails for composite OR filter on empty list collection InMemory query evaluation with a variable that has no possible values just returns rather than trying with "null" as the value
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).

Andy Jefferson made changes - 26/Feb/13 02:45 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.2.0.release [ 11710 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 08/Mar/13 02:57 PM
Status Resolved [ 5 ] Closed [ 6 ]