This discussion is archived
2 Replies Latest reply: Mar 21, 2013 4:26 AM by 997845 RSS

CohQL string comparison issue

917390 Newbie
Currently Being Moderated
Hello,

OS: Win7, 64-bit.
Coherence: (windows-x86-vs2005) 3.7.1.1 x86 Release

We have a simple cache where key and value objects have a currency, just a simple Java String.

private String currency;

All keys should have the same currency as their corresponding value.

Once we've populated our cache (both key and value currencies are written with writeString) we run some CohQL queries to analyze the data...

SELECT DISTINCT key().currency FROM Foo;

EUR
USD

SELECT DISTINCT value().currency FROM Foo;

EUR
USD

...which is fine.

If we run the query below we expect ZERO results as key currencies should always match value currencies...

select key().currency, value().currency from Foo where key().currency != value().currency;

...however it returns ALL the data in the cache, showing IDENTICAL key and value currencies.

"EUR", "EUR"
"USD", "USD"
"EUR", "EUR"
"USD", "USD"
"USD", "USD"
"EUR", "EUR"
"USD", "USD"
"EUR", "EUR"

This doesn't make sense. We've tried all combinations of IS, IS NOT etc always with the same result.

These queries on the same data return the same counts (which we expect).

SELECT COUNT() FROM Foo WHERE value().currency = "USD"
SELECT COUNT() FROM Foo WHERE key().currency = "USD"

Selecting * from the cache shows that the currencies are correct.

Any ideas what's going on? Any ideas how to diagnose this further? We're very confused. Perhaps we're misunderstanding query fundementals...

Thanks in advance.

Edited by: DonLonDon on Mar 18, 2013 11:25 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points