[ 
https://issues.apache.org/jira/browse/IGNITE-13280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17179519#comment-17179519
 ] 

Taras Ledkov commented on IGNITE-13280:
---------------------------------------

[~zstan] test to reproduce (for class {{BasicIndexTest}}):
{code}
    /**
     *  Checks index usage for full coverage.
     */
    @Test
    public void testConditionsWithoutIndexes2() throws Exception {
        inlineSize = 10;

        srvLog = new ListeningTestLogger(false, log);

        IgniteEx ig0 = startGrid(0);

        GridQueryProcessor qryProc = ig0.context().query();

        populateTable(qryProc, TEST_TBL_NAME, 1, "ID", "VAL0", "VAL1");

        String sqlIdx = String.format("create index \"idx1\" on %s(VAL0, 
VAL1)", TEST_TBL_NAME);

        qryProc.querySqlFields(new SqlFieldsQuery(sqlIdx), true).getAll();

        assertFalse(checkIdxUsed(qryProc, null, TEST_TBL_NAME, "VAL1"));

        assertTrue(checkIdxUsed(qryProc, "idx1", TEST_TBL_NAME, "VAL0"));
    }


{code}

> Improper index usage, fields enumeration not used with pk index creation.
> -------------------------------------------------------------------------
>
>                 Key: IGNITE-13280
>                 URL: https://issues.apache.org/jira/browse/IGNITE-13280
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.8.1
>            Reporter: Stanilovsky Evgeny
>            Assignee: Stanilovsky Evgeny
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> For example:
> {code:java}
> CREATE TABLE PUBLIC.TEST_TABLE (FIRST_NAME VARCHAR, LAST_NAME VARCHAR, 
> ADDRESS VARCHAR, LANG VARCHAR,  CONSTRAINT PK_PERSON PRIMARY KEY (FIRST_NAME, 
> LAST_NAME));
> CREATE INDEX "idx2" ON PUBLIC.TEST_TABLE (LANG, ADDRESS);
> {code}
> and further explain:
> {code:java}
> SELECT
>     "__Z0"."FIRST_NAME" AS "__C0_0",
>     "__Z0"."LAST_NAME" AS "__C0_1",
>     "__Z0"."ADDRESS" AS "__C0_2",
>     "__Z0"."LANG" AS "__C0_3"
> FROM "PUBLIC"."TEST_TABLE" "__Z0"
>     /* PUBLIC.IDX2: ADDRESS > 0 */
> WHERE "__Z0"."ADDRESS" > 0
> {code}
> this is erroneous  to use "idx2" here, because first index field LANG not 
> equals to predicate ADDRESS.
> Looks like this bug brings this ticket [1]
> [1] https://issues.apache.org/jira/browse/IGNITE-10217



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to