Vladimir Ozerov created IGNITE-8579:
---------------------------------------

             Summary: SQL: Unicast request with LIMIT should skip merge table 
if possible
                 Key: IGNITE-8579
                 URL: https://issues.apache.org/jira/browse/IGNITE-8579
             Project: Ignite
          Issue Type: Task
          Components: sql
    Affects Versions: 2.5
            Reporter: Vladimir Ozerov
             Fix For: 2.6


*Problem*
We have two cases when request could be executed only over a single partition:
1) With explicit partition
2) When partition pruning optimization reduced request to a single partition 
(IGNITE-4509). E.g. if {{department_id}} is affinity key in the query below:
{code}
SELECT * FROM emp WHERE department_id=? LIMIT 50;
{code}

In both cases we need to ensure that instead of fully-fledged two-step 
execution, we perform only map request, and reduce phase is skipped. I.e. 
{{org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery#skipMergeTbl}}
 is resolved to true.

*Reproducer*
The following query reproduces a situation when this is not the case at the 
moment, and merge table is initialized
{code}
CREATE TABLE emp (pk_id BIGINT, dept_ID BIGINT, name VARCHAR, PRIMARY 
KEY(pk_id, dept_id) WITH "AFFINITY_KEY=dept_id";
SELECT * FROM emp WHERE dept_id=? LIMIT 10
{code}

Notice that reduce phase exists, while in reality it is not needed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to