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

Guoliang Sun commented on KYLIN-6042:
-------------------------------------

h3. RootCause

When recommending model indexes, two modelContexts are recommended with only 
two differences:  
1. Whether the indexRexItemMap has a value, which corresponds to the detailed 
index column number in the issue.  
2. The snapShotSelected attribute value, where true indicates the information 
is from a snapshot, and false indicates it is from the model.  

Looking at the SQL, normally it could be handled within one modelContext. 
However, due to special function processing in the join condition columns and 
the use of a right join, it is split into two modelContexts. One attempts to 
match the snapshot, while the other matches the model. When a snapshot is 
identified, the detailed index is not included in the recommendation; the index 
is recommended only on the model.  
{code:java}
SELECT
    c.*
FROM
    (
        select
            a.*,
            b.*
        from
            (
                SELECT
                    LO_ORDERPRIOTITY AS LO_ORDERPRIOTITY
                FROM
                    SSB.LINEORDER
            ) a
            right join (
                select
                    *
                from
                    (
                        SELECT
                            trim(C_NAME) AS C_NAME
                        FROM
                            SSB.CUSTOMER
                    ) d
            ) b on trim(a.LO_ORDERPRIOTITY) = b.C_NAME {code}
In subsequent processing logic, only the index information in the first found 
modelContext (which is the snapshot) is processed. The modelId is used when 
searching for the model, but this value is the same in both modelContexts. 
Following the operation order described in the reproduction steps, the first 
found modelContext is consistently the one without index information (i.e., the 
snapshot). As a result, the deletion operation becomes ineffective, leading to 
the observed behavior where the parameters appear to have no effect.

> Model acceleration interface: The parameter discard_table_index is not taking 
> effect
> ------------------------------------------------------------------------------------
>
>                 Key: KYLIN-6042
>                 URL: https://issues.apache.org/jira/browse/KYLIN-6042
>             Project: Kylin
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>            Reporter: Guoliang Sun
>            Priority: Major
>
> 1. When the parameter discard_table_index is true, detailed index suggestions 
> are still generated. API: kylin/api/models/model_optimization  
> 2. SQL reference
> {code:java}
> SELECT c.* FROM ( 
>     select a.*, b.* from (
>         SELECT LO_ORDERPRIOTITY AS LO_ORDERPRIOTITY 
>         FROM HANHAN_LOGICAL_VIEW.LOGICAL_VIEW_LINEORDER 
>     ) a 
>     right join ( 
>         select * from (
>             SELECT trim(C_NAME) AS C_NAME 
>             FROM SSB.CUSTOMER 
>         ) d 
>     ) b  
>     on trim(a.LO_ORDERPRIOTITY)=b.C_NAME 
> ) c{code}
> 3. Two modelContexts were generated with the same targetModel. The 
> findFirst() here caused the IndexRexItemMap in the second modelContext not to 
> be removed, resulting in the successful creation of detailed index 
> suggestions.  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to