kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaofeng...@apache.org
Subject kylin git commit: KYLIN-2068: add optional comment column when sync hive table columns
Date Wed, 12 Oct 2016 01:27:08 GMT
Repository: kylin
Updated Branches:
  refs/heads/master 460536c00 -> 58afe0103


KYLIN-2068: add optional comment column when sync hive table columns

Signed-off-by: shaofengshi <shaofengshi@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/58afe010
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/58afe010
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/58afe010

Branch: refs/heads/master
Commit: 58afe0103098dd0845cb50a0751e3305a973f834
Parents: 460536c
Author: Yiming Liu <liuyiming.vip@gmail.com>
Authored: Mon Oct 10 23:49:19 2016 +0800
Committer: shaofengshi <shaofengshi@apache.org>
Committed: Wed Oct 12 09:25:24 2016 +0800

----------------------------------------------------------------------
 .../apache/kylin/metadata/model/ColumnDesc.java | 13 ++++++
 examples/sample_cube/create_sample_tables.sql   | 49 +++++++++++---------
 .../source/hive/HiveSourceTableLoader.java      |  1 +
 webapp/app/js/model/tableConfig.js              |  3 +-
 webapp/app/partials/tables/table_detail.html    |  4 ++
 5 files changed, 46 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/58afe010/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
index 257cb3b..d131b92 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/ColumnDesc.java
@@ -20,6 +20,7 @@ package org.apache.kylin.metadata.model;
 
 import java.io.Serializable;
 
+import com.fasterxml.jackson.annotation.JsonInclude;
 import org.apache.commons.lang.StringUtils;
 import org.apache.kylin.metadata.datatype.DataType;
 
@@ -51,6 +52,9 @@ public class ColumnDesc implements Serializable {
     private String name;
     @JsonProperty("datatype")
     private String datatype;
+    @JsonProperty("comment")
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    private String comment;
 
     // parsed from data type
     private DataType type;
@@ -109,6 +113,14 @@ public class ColumnDesc implements Serializable {
         this.table = table;
     }
 
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
     public DataType getType() {
         return type;
     }
@@ -195,6 +207,7 @@ public class ColumnDesc implements Serializable {
                 "id='" + id + '\'' +
                 ", name='" + name + '\'' +
                 ", datatype='" + datatype + '\'' +
+                ", comment='" + comment + '\'' +
                 '}';
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/58afe010/examples/sample_cube/create_sample_tables.sql
----------------------------------------------------------------------
diff --git a/examples/sample_cube/create_sample_tables.sql b/examples/sample_cube/create_sample_tables.sql
index 8399ee8..fa5e25b 100644
--- a/examples/sample_cube/create_sample_tables.sql
+++ b/examples/sample_cube/create_sample_tables.sql
@@ -20,11 +20,11 @@ DROP TABLE IF EXISTS DEFAULT.KYLIN_CAL_DT;
 
 CREATE TABLE DEFAULT.KYLIN_CAL_DT
 (
-CAL_DT date
-,YEAR_BEG_DT date
-,QTR_BEG_DT date
-,MONTH_BEG_DT date
-,WEEK_BEG_DT date
+CAL_DT date COMMENT 'Date, PK'
+,YEAR_BEG_DT date COMMENT 'YEAR Begin Date'
+,QTR_BEG_DT date COMMENT 'Quarter Begin Date'
+,MONTH_BEG_DT date COMMENT 'Month Begin Date'
+,WEEK_BEG_DT date COMMENT 'Week Begin Date'
 ,AGE_FOR_YEAR_ID smallint
 ,AGE_FOR_QTR_ID smallint
 ,AGE_FOR_MONTH_ID smallint
@@ -121,6 +121,7 @@ CAL_DT date
 ,UPD_DATE string
 ,UPD_USER string
 )
+COMMENT 'Date Dimension Table'
 ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
 STORED AS TEXTFILE;
 
@@ -128,28 +129,28 @@ DROP TABLE IF EXISTS DEFAULT.KYLIN_CATEGORY_GROUPINGS;
 
 CREATE TABLE DEFAULT.KYLIN_CATEGORY_GROUPINGS
 (
-LEAF_CATEG_ID bigint
+LEAF_CATEG_ID bigint COMMENT 'Category ID, PK'
 ,LEAF_CATEG_NAME string
-,SITE_ID int
+,SITE_ID int COMMENT 'Site ID, PK'
 ,CATEG_BUSN_MGR string
 ,CATEG_BUSN_UNIT string
 ,REGN_CATEG string
-,USER_DEFINED_FIELD1 string
-,USER_DEFINED_FIELD3 string
+,USER_DEFINED_FIELD1 string COMMENT 'User Defined Field1'
+,USER_DEFINED_FIELD3 string COMMENT 'User Defined Field3'
 ,CRE_DATE string
-,UPD_DATE string
+,UPD_DATE string COMMENT 'Last Updated Date'
 ,CRE_USER string
-,UPD_USER string
+,UPD_USER string COMMENT 'Last Updated User'
 ,META_CATEG_ID decimal
-,META_CATEG_NAME string
+,META_CATEG_NAME string COMMENT 'Level1 Category'
 ,CATEG_LVL2_ID decimal
 ,CATEG_LVL3_ID decimal
 ,CATEG_LVL4_ID decimal
 ,CATEG_LVL5_ID decimal
 ,CATEG_LVL6_ID decimal
 ,CATEG_LVL7_ID decimal
-,CATEG_LVL2_NAME string
-,CATEG_LVL3_NAME string
+,CATEG_LVL2_NAME string COMMENT 'Level2 Category'
+,CATEG_LVL3_NAME string COMMENT 'Level3 Category'
 ,CATEG_LVL4_NAME string
 ,CATEG_LVL5_NAME string
 ,CATEG_LVL6_NAME string
@@ -165,6 +166,7 @@ LEAF_CATEG_ID bigint
 ,SRC_ID tinyint
 ,BSNS_VRTCL_NAME string
 )
+COMMENT 'Detail category inforamtion, Dimension Table'
 ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
 STORED AS TEXTFILE;
 
@@ -173,17 +175,18 @@ DROP TABLE IF EXISTS DEFAULT.KYLIN_SALES;
 CREATE TABLE DEFAULT.KYLIN_SALES
 (
 TRANS_ID bigint
-,PART_DT date
-,LSTG_FORMAT_NAME string
-,LEAF_CATEG_ID bigint
-,LSTG_SITE_ID int
+,PART_DT date COMMENT 'Order Date'
+,LSTG_FORMAT_NAME string COMMENT 'Order Transaction Type'
+,LEAF_CATEG_ID bigint COMMENT 'Category ID'
+,LSTG_SITE_ID int COMMENT 'Site ID'
 ,SLR_SEGMENT_CD smallint
-,PRICE decimal(19,4)
-,ITEM_COUNT bigint
-,SELLER_ID bigint
-,USER_ID string
-,REGION string
+,PRICE decimal(19,4) COMMENT 'Order Price'
+,ITEM_COUNT bigint COMMENT 'Number of Purchased Goods'
+,SELLER_ID bigint COMMENT 'Seller ID'
+,USER_ID string COMMENT 'USER ID'
+,REGION string COMMENT 'REGION'
 )
+COMMENT 'Sales order table, fact table'
 ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
 STORED AS TEXTFILE;
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/58afe010/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java
----------------------------------------------------------------------
diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java
b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java
index 8b98e7b..ec9aedb 100644
--- a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java
+++ b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveSourceTableLoader.java
@@ -133,6 +133,7 @@ public class HiveSourceTableLoader {
                     cdesc.setDatatype(field.getType());
                 }
                 cdesc.setId(String.valueOf(i + 1));
+                cdesc.setComment(field.getComment());
                 columns.add(cdesc);
             }
             tableDesc.setColumns(columns.toArray(new ColumnDesc[columnNumber]));

http://git-wip-us.apache.org/repos/asf/kylin/blob/58afe010/webapp/app/js/model/tableConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/tableConfig.js b/webapp/app/js/model/tableConfig.js
index 3dd7b25..2198018 100644
--- a/webapp/app/js/model/tableConfig.js
+++ b/webapp/app/js/model/tableConfig.js
@@ -21,7 +21,8 @@ KylinApp.constant('tableConfig', {
     {attr: 'id', name: 'ID'},
     {attr: 'name', name: 'Name'},
     {attr: 'datatype', name: 'Data Type'},
-    {attr: 'cardinality', name: 'Cardinality'}
+    {attr: 'cardinality', name: 'Cardinality'},
+    {attr: 'comment', name: 'Comment'}
   ],
   dataTypes:["tinyint","smallint","int","bigint","float","double","decimal","timestamp","date","string","varchar(256)","char","boolean","binary"]
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/58afe010/webapp/app/partials/tables/table_detail.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/table_detail.html b/webapp/app/partials/tables/table_detail.html
index a4548a1..5bae00f 100644
--- a/webapp/app/partials/tables/table_detail.html
+++ b/webapp/app/partials/tables/table_detail.html
@@ -136,6 +136,10 @@
                     <!--{{ tableModel.selectedSrcTable.cardinality[column.name]}}-->
                     {{column.cardinality}}
                   </td>
+                  <td
+                    style="{{(tableModel.selectedSrcTable.selectedSrcColumn.id == column.id)?
'background-color:#EBF9FE':''}}">
+                    {{ column.comment}}
+                  </td>
                 </tr>
               </table>
             </div>


Mime
View raw message