Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1189: criteria-geode backend toLowerCase/toUpperCase add parentheses #1190

Merged

Conversation

garrettlestingi
Copy link
Contributor

This was a small change so I took a crack at it. Below is the log evidence that toUpperCase and toLowerCase is now working in my example app:

Jun 17, 2020 2:37:58 AM org.immutables.criteria.geode.SyncSelect call
FINE: Querying Geode with oql=[SELECT * FROM /person WHERE name.toLowerCase() = $1]  with 1 variables [$1=garrett]
Jun 17, 2020 2:37:58 AM Main main
INFO: toLowerCase() number of results: 2
Jun 17, 2020 2:37:58 AM org.immutables.criteria.geode.SyncSelect call
FINE: Querying Geode with oql=[SELECT * FROM /person WHERE name.toUpperCase() = $1]  with 1 variables [$1=GARRETT]
Jun 17, 2020 2:37:58 AM Main main
INFO: toUpperCase() number of results: 2
Jun 17, 2020 2:37:58 AM org.immutables.criteria.geode.SyncSelect call
FINE: Querying Geode with oql=[SELECT * FROM /person WHERE name = $1]  with 1 variables [$1=garrett]
Jun 17, 2020 2:37:58 AM Main main
INFO: is number of results: 1

@asereda-gs
Copy link
Member

asereda-gs commented Jun 17, 2020

Thanks for contribution!

Does it mean that existing upperLower test is invalid ?

Even their example doesn't use parenthesis (()):

SELECT * FROM /exampleRegion WHERE foo.toLowerCase LIKE '%bar%'

From what I remember it is optional in Geode.

But is is hard to argue if your concrete example doesn't work.

@garrettlestingi
Copy link
Contributor Author

Thanks for the quick response!

I believe the upperLower test case from the GeodeIntegrationTest is using AutoCreateRegion to create a LOCAL region. Using a LOCAL region returns expected results without the parentheses even in my concrete example:

    // if not, create
    cache.createRegionFactory()
            .setScope(Scope.LOCAL) // otherwise ConcurrentMap API doesn't work for Region
            .setValueConstraint(valueConstraint)
            .create(name);

I was also confused why the only example in their documentation does not use parentheses, but when I test using queries in gfsh similar to their example, these are my results:

gfsh>query --query="select count(*) from /person where name.toLowerCase LIKE '%garrett%'"
Result : true
Rows   : 1

Result
------
0
gfsh>query --query="select count(*) from /person where name.toLowerCase() LIKE '%garrett%'"
Result : true
Rows   : 1

Result
------
2

@asereda-gs asereda-gs merged commit 5893faf into immutables:master Jun 17, 2020
@asereda-gs
Copy link
Member

Thanks for PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants