189 words

Unexpected COUNT Results

#1
2015-03-06 14:57

We are working with objectDB version 2.5.5.b01. (we also tried to use the latest version 2.6.1)

We have several issues with queries that can be seen with the attached database and using ObjectDB explorer:
1.       Using ObjectDB explorer
a.       SELECT $1.id FROM Pa3DataKey $1 WHERE $1.timestamp <= 187526 AND ($1.dataItems.get('Sender') != 'PHY' AND $1.dataItems.get('Receiver') != 'PHY') AND ($1.keyDescriptor.name="MESSAGE" AND $1.keyDescriptor.namespace="com.anritsu.pa3")

This query returns the list with size  1380. This is expected result

If we add COUNT operator:
b.      SELECT COUNT($1.id) FROM Pa3DataKey $1 WHERE $1.timestamp <= 187526 AND ($1.dataItems.get('Sender') != 'PHY' AND $1.dataItems.get('Receiver') != 'PHY') AND ($1.keyDescriptor.name="MESSAGE" AND $1.keyDescriptor.namespace="com.anritsu.pa3")

This query returns value 25268. This is not correct value. We expect 1380

If we swap $1.dataItems.get('Sender') != 'PHY' and $1.dataItems.get('Receiver') != 'PHY' e.g:
c.       SELECT COUNT($1.id) FROM Pa3DataKey $1 WHERE $1.timestamp <= 187526 AND ($1.dataItems.get('Receiver') != 'PHY' AND $1.dataItems.get('Sender') != 'PHY') AND ($1.keyDescriptor.name="MESSAGE" AND $1.keyDescriptor.namespace="com.anritsu.pa3")

This query returns value 1758. This is not expected result

The same issue is seen when performing the query from java code

Can you please explain why query results in 1.b and 1.c are not as expected? Why order of conditions (1.c) affects the result?

Thanks,

Duncan

djamesbell
djamesbell's picture
Joined on 2015-03-06
User Post #1
#2
2015-03-06 18:34

Thank you for this report. Build 2.6.1_02 fixes this bug.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,165

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel