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


With regards,
Apache Git Services

Reply via email to