You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by Real Wes Williams <Th...@outlook.com> on 2015/11/17 23:32:53 UTC

Joining Two Colocated Partitioned Regions in a Function

Hi team,

Executing a join query inside a function is returning an error for a reason that it should not.  The error message says that a join won't work unless it’s inside a function. But I AM inside a function! Need some guidance. I'm not even doing anything with the second region. It's just defined. How can I get a proper join to work if both are partitioned?

[error 2015/11/17 16:46:10.627 EST server1 <*Function Execution* Processor1> tid=0x45] Function search-inventory-function:
  java.lang.UnsupportedOperationException: A query on a Partitioned Region ( Instruments ) may not reference any other region if query is NOT executed within a Function

*SELECT p.instrumentId FROM /Prices p, /Instruments;*

Both are partitioned. Both are colocated on instrumentId. The query is being executed inside of a function.onRegion(…).  

How can I get a proper join to work if both are partitioned? I thought this was supported.

Thanks,
Wes

Re: Joining Two Colocated Partitioned Regions in a Function

Posted by Mark Secrist <ms...@pivotal.io>.
A slide from the GemFire Developer class on queries within a function. The
key is that when executing the function, you pass in the
RegionFunctionContext which helps the query executor focus solely on region
data on the same Cache Server instance.
[image: Inline image 1]
If I remember correctly, this was leverages from one of the examples in the
sample code delivered with the Geode (or GemFire) installation.

On Tue, Nov 17, 2015 at 4:49 PM, Barry Oglesby <bo...@pivotal.io> wrote:

> Wes,
>
> Attached is an example that loads colocated partitioned regions with
> customers and orders and uses a function to execute a join query against
> them.
>
> It has a readme that describes how to run it. Let me know if you have any
> issues.
>
> Thanks,
>
> Barry Oglesby
> GemFire Advanced Customer Engineering (ACE)
> For immediate support please contact Pivotal Support at
> http://support.pivotal.io/
>
>
> On Tue, Nov 17, 2015 at 2:32 PM, Real Wes Williams <TheRealWes@outlook.com
> > wrote:
>
>>
>> Hi team,
>>
>> Executing a join query inside a function is returning an error for a
>> reason that it should not.  The error message says that a join won't work
>> unless it’s inside a function. But I AM inside a function! Need some
>> guidance. I'm not even doing anything with the second region. It's just
>> defined. How can I get a proper join to work if both are partitioned?
>>
>> [error 2015/11/17 16:46:10.627 EST server1 <**Function Execution** Processor1>
>> tid=0x45] Function search-inventory-function:
>>   java.lang.UnsupportedOperationException: A query on a Partitioned
>> Region ( Instruments ) may not reference any other region if query is NOT
>> executed within a Function
>>
>> *SELECT p.instrumentId FROM /Prices p, /Instruments;*
>>
>> Both are partitioned. Both are colocated on instrumentId. The query is
>> being executed inside of a function.onRegion(…).
>>
>> How can I get a proper join to work if both are partitioned? I thought
>> this was supported.
>>
>> Thanks,
>> Wes
>>
>
>


-- 

*Mark Secrist | Sr Manager, **Global Education Delivery*

msecrist@pivotal.io

970.214.4567 Mobile

  *pivotal.io <http://www.pivotal.io/>*

Follow Us: Twitter <http://www.twitter.com/pivotal> | LinkedIn
<http://www.linkedin.com/company/pivotalsoftware> | Facebook
<http://www.facebook.com/pivotalsoftware> | YouTube
<http://www.youtube.com/gopivotal> | Google+
<https://plus.google.com/105320112436428794490>

Re: Joining Two Colocated Partitioned Regions in a Function

Posted by Barry Oglesby <bo...@pivotal.io>.
Wes,

Attached is an example that loads colocated partitioned regions with
customers and orders and uses a function to execute a join query against
them.

It has a readme that describes how to run it. Let me know if you have any
issues.

Thanks,

Barry Oglesby
GemFire Advanced Customer Engineering (ACE)
For immediate support please contact Pivotal Support at
http://support.pivotal.io/


On Tue, Nov 17, 2015 at 2:32 PM, Real Wes Williams <Th...@outlook.com>
wrote:

>
> Hi team,
>
> Executing a join query inside a function is returning an error for a
> reason that it should not.  The error message says that a join won't work
> unless it’s inside a function. But I AM inside a function! Need some
> guidance. I'm not even doing anything with the second region. It's just
> defined. How can I get a proper join to work if both are partitioned?
>
> [error 2015/11/17 16:46:10.627 EST server1 <**Function Execution** Processor1>
> tid=0x45] Function search-inventory-function:
>   java.lang.UnsupportedOperationException: A query on a Partitioned
> Region ( Instruments ) may not reference any other region if query is NOT
> executed within a Function
>
> *SELECT p.instrumentId FROM /Prices p, /Instruments;*
>
> Both are partitioned. Both are colocated on instrumentId. The query is
> being executed inside of a function.onRegion(…).
>
> How can I get a proper join to work if both are partitioned? I thought
> this was supported.
>
> Thanks,
> Wes
>

Re: Joining Two Colocated Partitioned Regions in a Function

Posted by Barry Oglesby <bo...@pivotal.io>.
I think that is an incorrectly worded exception message. It really means if
the query is not using a RegionFunctionContext. How are you executing the
query in the function? I'll send you an example.

Barry Oglesby
GemFire Advanced Customer Engineering (ACE)
For immediate support please contact Pivotal Support at
http://support.pivotal.io/


On Tue, Nov 17, 2015 at 2:32 PM, Real Wes Williams <Th...@outlook.com>
wrote:

>
> Hi team,
>
> Executing a join query inside a function is returning an error for a
> reason that it should not.  The error message says that a join won't work
> unless it’s inside a function. But I AM inside a function! Need some
> guidance. I'm not even doing anything with the second region. It's just
> defined. How can I get a proper join to work if both are partitioned?
>
> [error 2015/11/17 16:46:10.627 EST server1 <**Function Execution** Processor1>
> tid=0x45] Function search-inventory-function:
>   java.lang.UnsupportedOperationException: A query on a Partitioned
> Region ( Instruments ) may not reference any other region if query is NOT
> executed within a Function
>
> *SELECT p.instrumentId FROM /Prices p, /Instruments;*
>
> Both are partitioned. Both are colocated on instrumentId. The query is
> being executed inside of a function.onRegion(…).
>
> How can I get a proper join to work if both are partitioned? I thought
> this was supported.
>
> Thanks,
> Wes
>