You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by Dharam Thacker <dh...@gmail.com> on 2017/11/03 18:56:37 UTC

Need some help with oql query

Hi,

could some one help me to design oql query?

Here is the region structure as Region <String,PdxInstance>
Key1 -> [*index=100*,maturity=*200*]
Key2 -> [index=100,*maturity=100*]

I am trying to design a query to *get index based on maturity...*

select i.index from /data i where i.maturity=200 and *not* (i.index in set
(select i1.maturity from /data i2)) [This works well for step1 and filters
result for step2 but does not give answer for step2]

1. Get maturity based on index [Simple rule]
2. But if step1 gives index which itself is maturity anywhere, then simply
output incoming maturity as it is [So in this case 200]

Thanks,
- Dharam Thacker

Re: Need some help with oql query

Posted by Dharam Thacker <dh...@gmail.com>.
Thanks Anil!

Yes that's exactly the case. I am getting zero result and expecting to get
maturity as 200.

Do you see any better way to write this query or function is the only
choice so as to avoid multiple round-trips?

Thanks,
Dharam

On Nov 6, 2017 11:24 PM, "Anilkumar Gingade" <ag...@pivotal.io> wrote:

The query engine doesn't have orElse semantic; spring may be generating
appropriate query based on the condition...

I assume you are getting zero results for your query; And you are expecting
to get one results with maturity value 200.

-Anil.


On Sat, Nov 4, 2017 at 4:09 AM, Dharam Thacker <dh...@gmail.com>
wrote:

> I found orElse keyword usage in spring data geode but would like to know
> if it's natively supported in oql query grammer.
>
> getPersonRepository().findById(id).orElse(null);
>
>
> Thanks,
> Dharam
>
> On Nov 4, 2017 00:26, "Dharam Thacker" <dh...@gmail.com> wrote:
>
> Hi,
>
> could some one help me to design oql query?
>
> Here is the region structure as Region <String,PdxInstance>
> Key1 -> [*index=100*,maturity=*200*]
> Key2 -> [index=100,*maturity=100*]
>
> I am trying to design a query to *get index based on maturity...*
>
> select i.index from /data i where i.maturity=200 and *not* (i.index in
> set (select i1.maturity from /data i2)) [This works well for step1 and
> filters result for step2 but does not give answer for step2]
>
> 1. Get maturity based on index [Simple rule]
> 2. But if step1 gives index which itself is maturity anywhere, then simply
> output incoming maturity as it is [So in this case 200]
>
> Thanks,
> - Dharam Thacker
>
>
>

Re: Need some help with oql query

Posted by Anilkumar Gingade <ag...@pivotal.io>.
The query engine doesn't have orElse semantic; spring may be generating
appropriate query based on the condition...

I assume you are getting zero results for your query; And you are expecting
to get one results with maturity value 200.

-Anil.


On Sat, Nov 4, 2017 at 4:09 AM, Dharam Thacker <dh...@gmail.com>
wrote:

> I found orElse keyword usage in spring data geode but would like to know
> if it's natively supported in oql query grammer.
>
> getPersonRepository().findById(id).orElse(null);
>
>
> Thanks,
> Dharam
>
> On Nov 4, 2017 00:26, "Dharam Thacker" <dh...@gmail.com> wrote:
>
> Hi,
>
> could some one help me to design oql query?
>
> Here is the region structure as Region <String,PdxInstance>
> Key1 -> [*index=100*,maturity=*200*]
> Key2 -> [index=100,*maturity=100*]
>
> I am trying to design a query to *get index based on maturity...*
>
> select i.index from /data i where i.maturity=200 and *not* (i.index in
> set (select i1.maturity from /data i2)) [This works well for step1 and
> filters result for step2 but does not give answer for step2]
>
> 1. Get maturity based on index [Simple rule]
> 2. But if step1 gives index which itself is maturity anywhere, then simply
> output incoming maturity as it is [So in this case 200]
>
> Thanks,
> - Dharam Thacker
>
>
>

Re: Need some help with oql query

Posted by Dharam Thacker <dh...@gmail.com>.
I found orElse keyword usage in spring data geode but would like to know if
it's natively supported in oql query grammer.

getPersonRepository().findById(id).orElse(null);


Thanks,
Dharam

On Nov 4, 2017 00:26, "Dharam Thacker" <dh...@gmail.com> wrote:

Hi,

could some one help me to design oql query?

Here is the region structure as Region <String,PdxInstance>
Key1 -> [*index=100*,maturity=*200*]
Key2 -> [index=100,*maturity=100*]

I am trying to design a query to *get index based on maturity...*

select i.index from /data i where i.maturity=200 and *not* (i.index in set
(select i1.maturity from /data i2)) [This works well for step1 and filters
result for step2 but does not give answer for step2]

1. Get maturity based on index [Simple rule]
2. But if step1 gives index which itself is maturity anywhere, then simply
output incoming maturity as it is [So in this case 200]

Thanks,
- Dharam Thacker