You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Anil <an...@gmail.com> on 2017/02/23 11:34:37 UTC

QueryCursor with Order by query

Hi,

QueryCursor is used to get the records in pages instead of loading all
records into client memory.

and I understand that sorting needs to get all the records into client
(assuming reducer is client. correct me if i am wrong) memory.

How does QueryCursor with sort query behaves ? Thanks.

Thanks.

Re: QueryCursor with Order by query

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi Anil,

Merge table is created on reduce side. Find usages of
GridReduceQueryExecutor.createMergeTable() method.

On Thu, Feb 23, 2017 at 8:08 PM, Anil <an...@gmail.com> wrote:

> Thanks Andrey.
>
> where are these merge temporary tables created ? on client ? i may need to
> more to time to understand the internal code :)
>
> Thanks
>
> On 23 February 2017 at 20:21, Andrey Mashenkov <andrey.mashenkov@gmail.com
> > wrote:
>
>> Hi Anil,
>>
>> Query initiator node will fetch all records before appling sorting. It is
>> known bug [1], and I hope it will be fixed soon.
>>
>> What about QueryCursor, it is just wrapper that supports query
>> cancellation. Pagination is applied to load map-queries results by reducer
>> in async manner.
>>
>> Looking at these classes can help you to understand how it works:
>> GridReduceQueryExecutor, GridMapQueryExecutor, GridMergeIndex,
>> GridQueryNextPageRequest, GridQueryNextPageResponse
>> It looks like sorting is applied by H2 internals when reducer makes query
>> to merge table.
>>
>>
>> [1] https://issues.apache.org/jira/browse/IGNITE-3013
>>
>> On Thu, Feb 23, 2017 at 2:34 PM, Anil <an...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> QueryCursor is used to get the records in pages instead of loading all
>>> records into client memory.
>>>
>>> and I understand that sorting needs to get all the records into client
>>> (assuming reducer is client. correct me if i am wrong) memory.
>>>
>>> How does QueryCursor with sort query behaves ? Thanks.
>>>
>>> Thanks.
>>>
>>
>>
>>
>> --
>> Best regards,
>> Andrey V. Mashenkov
>>
>
>


-- 
Best regards,
Andrey V. Mashenkov

Re: QueryCursor with Order by query

Posted by Anil <an...@gmail.com>.
Thanks Andrey.

where are these merge temporary tables created ? on client ? i may need to
more to time to understand the internal code :)

Thanks

On 23 February 2017 at 20:21, Andrey Mashenkov <an...@gmail.com>
wrote:

> Hi Anil,
>
> Query initiator node will fetch all records before appling sorting. It is
> known bug [1], and I hope it will be fixed soon.
>
> What about QueryCursor, it is just wrapper that supports query
> cancellation. Pagination is applied to load map-queries results by reducer
> in async manner.
>
> Looking at these classes can help you to understand how it works:
> GridReduceQueryExecutor, GridMapQueryExecutor, GridMergeIndex,
> GridQueryNextPageRequest, GridQueryNextPageResponse
> It looks like sorting is applied by H2 internals when reducer makes query
> to merge table.
>
>
> [1] https://issues.apache.org/jira/browse/IGNITE-3013
>
> On Thu, Feb 23, 2017 at 2:34 PM, Anil <an...@gmail.com> wrote:
>
>> Hi,
>>
>> QueryCursor is used to get the records in pages instead of loading all
>> records into client memory.
>>
>> and I understand that sorting needs to get all the records into client
>> (assuming reducer is client. correct me if i am wrong) memory.
>>
>> How does QueryCursor with sort query behaves ? Thanks.
>>
>> Thanks.
>>
>
>
>
> --
> Best regards,
> Andrey V. Mashenkov
>

Re: QueryCursor with Order by query

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi Anil,

Query initiator node will fetch all records before appling sorting. It is
known bug [1], and I hope it will be fixed soon.

What about QueryCursor, it is just wrapper that supports query
cancellation. Pagination is applied to load map-queries results by reducer
in async manner.

Looking at these classes can help you to understand how it works:
GridReduceQueryExecutor, GridMapQueryExecutor, GridMergeIndex,
GridQueryNextPageRequest, GridQueryNextPageResponse
It looks like sorting is applied by H2 internals when reducer makes query
to merge table.


[1] https://issues.apache.org/jira/browse/IGNITE-3013

On Thu, Feb 23, 2017 at 2:34 PM, Anil <an...@gmail.com> wrote:

> Hi,
>
> QueryCursor is used to get the records in pages instead of loading all
> records into client memory.
>
> and I understand that sorting needs to get all the records into client
> (assuming reducer is client. correct me if i am wrong) memory.
>
> How does QueryCursor with sort query behaves ? Thanks.
>
> Thanks.
>



-- 
Best regards,
Andrey V. Mashenkov