ObjectDB ObjectDB

Unexpected COUNT Results

#1

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

edit
delete
#2

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

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.