This is an automated email from the ASF dual-hosted git repository.

xxyu pushed a commit to branch kylin5
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit bc9ae6188e6632ba57899cf9e57e1ac9a5ce66d3
Author: Qian Xia <lauraxiaq...@gmail.com>
AuthorDate: Wed Apr 12 15:53:16 2023 +0800

    KYLIN-5505 remove cc column when delete fact tabel
---
 .../src/components/studio/StudioModel/ModelEdit/locales.js     |  2 +-
 kystudio/src/components/studio/StudioModel/ModelEdit/model.js  | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/kystudio/src/components/studio/StudioModel/ModelEdit/locales.js 
b/kystudio/src/components/studio/StudioModel/ModelEdit/locales.js
index 4e169e47b1..de9a6443c8 100644
--- a/kystudio/src/components/studio/StudioModel/ModelEdit/locales.js
+++ b/kystudio/src/components/studio/StudioModel/ModelEdit/locales.js
@@ -21,7 +21,7 @@ export default {
     'systemMaintainedTip3': 'System can delete this model',
     'avoidSysChange': 'Avoid system change semantics',
     'allowSysChange': 'Allow system change semantics',
-    'delTableTip': 'All dimensions, measures and joins using this table would 
be deleted. Are you sure you want to delete this table?',
+    'delTableTip': 'All dimensions, measures,joins and computed columns using 
this table would be deleted. Are you sure you want to delete this table?',
     'noFactTable': 'Please select a fact table.',
     switchLookup: 'Set as Dimension Table',
     switchFact: 'Set as Fact Table',
diff --git a/kystudio/src/components/studio/StudioModel/ModelEdit/model.js 
b/kystudio/src/components/studio/StudioModel/ModelEdit/model.js
index 8357231de8..ebef7523cc 100644
--- a/kystudio/src/components/studio/StudioModel/ModelEdit/model.js
+++ b/kystudio/src/components/studio/StudioModel/ModelEdit/model.js
@@ -835,11 +835,19 @@ class NModel extends Schama {
       // 删除对应的 tableindex
       this._delTableIndexByAlias(alias)
       // 删除对应的 cc
-      // this._delCCByAlias(alias)
+      this._delCCByAlias(alias)
       // 删除对应的partition
       this._delTableRelatedPartitionInfo(ntable)
     }
   }
+  _delCCByAlias (tableAlias) {
+    const ccList = this._mount.computed_columns.filter(it => it.tableAlias !== 
tableAlias)
+    this._mount.computed_columns = ccList
+    ccList.forEach(cc => {
+      let ccColumnName = typeof cc === 'object' ? cc.columnName : cc
+      this._delCCRelated(tableAlias, ccColumnName)
+    })
+  }
   getTable (key, val) {
     for (var i in this.tables) {
       if (this.tables[i][key] === val) {

Reply via email to