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

kangkaisen commented on KYLIN-1926:
-----------------------------------

We can reproduce this issue easily by changing the KYLIN_SALES.BUYER_ID from 
bigint to int.

Then we query this SQL:
{code:java}
select SUM(price) 
from KYLIN_SALES
inner join KYLIN_ACCOUNT
on KYLIN_SALES.BUYER_ID = KYLIN_ACCOUNT.ACCOUNT_ID
{code}


Finally, the "No model found" error will happen.

The logic chain  for this error is :

1 The datatype for KYLIN_SALES.BUYER_ID and KYLIN_ACCOUNT.ACCOUNT_ID is 
inconsistent

2 Calcite cast BUYER_ID from int to bigint

3 Calcite pushDownJoinConditions  join

4 Calcite create a Project with all KYLIN_SALES column and BUYER_ID cast column

5 Kylin Add the column startwith _KY_ to the context.allColumns

6 real.getAllColumnDescs() don't contain all context.allColumns because 
real.getAllColumnDescs() don't contain the column startwith _KY_ in ModelChooser

7 The "No model found" error will happen in ModelChooser

> Loosen the constraint on FK-PK data type matching
> -------------------------------------------------
>
>                 Key: KYLIN-1926
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1926
>             Project: Kylin
>          Issue Type: Improvement
>          Components: Metadata
>    Affects Versions: all
>            Reporter: Shaofeng SHI
>            Assignee: Shaofeng SHI
>            Priority: Minor
>             Fix For: v1.5.4
>
>         Attachments: 0001-KYLIN-1926-FK-PK-data-type-matching.patch
>
>
> If lookup table's PK datatype isn't equal to fact table's FK datatype, Kylin 
> will report error saying "Primary key are not consistent with Foreign key". 
> This constraint is too strong. Should allow user to disable this check.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to