[ https://issues.apache.org/jira/browse/KYLIN-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16625721#comment-16625721 ]
ASF GitHub Bot commented on KYLIN-3546: --------------------------------------- shaofengshi closed 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 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaInputBase.java b/source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaInputBase.java index a624f8fbb8..cb2e14ce5c 100644 --- a/source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaInputBase.java +++ b/source-kafka/src/main/java/org/apache/kylin/source/kafka/KafkaInputBase.java @@ -18,8 +18,11 @@ package org.apache.kylin.source.kafka; +import java.util.LinkedList; import java.util.List; +import java.util.Set; +import com.google.common.collect.Sets; import org.apache.kylin.cube.CubeSegment; import org.apache.kylin.cube.model.CubeDesc; import org.apache.kylin.engine.mr.JobBuilderSupport; @@ -32,7 +35,10 @@ import org.apache.kylin.metadata.model.DataModelDesc; import org.apache.kylin.metadata.model.IJoinedFlatTableDesc; import org.apache.kylin.metadata.model.ISegment; +import org.apache.kylin.metadata.model.JoinDesc; +import org.apache.kylin.metadata.model.JoinTableDesc; import org.apache.kylin.metadata.model.SegmentRange; +import org.apache.kylin.metadata.model.TableRef; import org.apache.kylin.metadata.model.TblColRef; import org.apache.kylin.source.hive.CreateFlatHiveTableStep; import org.apache.kylin.source.hive.GarbageCollectionStep; @@ -89,7 +95,23 @@ public DataModelDesc getDataModel() { @Override public List<TblColRef> getAllColumns() { - return flatDesc.getFactColumns(); + final Set<TblColRef> factTableColumnSet = Sets.newHashSet(); + TableRef rootFactTable = getDataModel().getRootFactTable(); + for (TblColRef colRef : flatDesc.getAllColumns()) { + if (colRef.getTableRef().equals(rootFactTable)) { + factTableColumnSet.add(colRef); + } + } + // Add column which belongs to root fact table in join relation but lost + for (JoinTableDesc joinTableDesc : getDataModel().getJoinTables()) { + JoinDesc join = joinTableDesc.getJoin(); + for (TblColRef colRef : join.getForeignKeyColumns()) { + if (colRef.getTableRef().equals(rootFactTable)) { + factTableColumnSet.add(colRef); + } + } + } + return new LinkedList<>(factTableColumnSet); } @Override ---------------------------------------------------------------- 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)