[ https://issues.apache.org/jira/browse/KYLIN-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623345#comment-16623345 ]
ASF GitHub Bot commented on KYLIN-3546: --------------------------------------- shaofengshi commented on a change in pull request #241: KYLIN-3546 Add column which belongs to root fact table in join relation but lost URL: https://github.com/apache/kylin/pull/241#discussion_r219434659 ########## File path: source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaInputBase.java ########## @@ -89,7 +95,28 @@ public DataModelDesc getDataModel() { @Override public List<TblColRef> getAllColumns() { - return flatDesc.getFactColumns(); + final Set<TblColRef> factTableColumnSet = Sets.newHashSet(); + TableRef rootFactTable = getDataModel().getRootFactTable(); + for (TblColRef col : flatDesc.getAllColumns()) { + if (col.getTableRef().equals(rootFactTable)) { + factTableColumnSet.add(col); + } + } + // Add column which belongs to root fact table in join relation but lost + for (JoinTableDesc joinTableDesc : getDataModel().getJoinTables()) { + JoinDesc jd = joinTableDesc.getJoin(); + for (TblColRef colRef : jd.getForeignKeyColumns()) { + if (colRef.getTableRef().equals(rootFactTable)) { + factTableColumnSet.add(colRef); + } + } + for (TblColRef colRef : jd.getPrimaryKeyColumns()) { Review comment: PK columns are on lookup tables, they won't be fact table, so this loop has no necessary to be here. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Kylin doesn't persist FK to intermediate table if FK is not a dimension > ----------------------------------------------------------------------- > > Key: KYLIN-3546 > URL: https://issues.apache.org/jira/browse/KYLIN-3546 > Project: Kylin > Issue Type: Bug > Components: Streaming > Affects Versions: v2.4.0 > Reporter: wlxie > Assignee: XiaoXiang Yu > Priority: Major > Fix For: v2.4.2, v2.5.1 > > Attachments: base_2018_09_18_09_23_53.zip, kylin_kafka.txt > > > 各位老师好, > 在使用kafka的streaming > table作为事实表创建cube时候,如果维度和指标都不选事实表中的关联键的话,在跑cube作业的时候,创建保存kafka数据的临时表会没有这个关联键,导致后面创建关联表的临时表会报错,具体报错信息请查看附件,谢谢。 -- This message was sent by Atlassian JIRA (v7.6.3#76005)