You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by xx...@apache.org on 2023/07/24 10:47:40 UTC
[kylin] 08/14: KYLIN-5661 fix del cc from fact table issue
This is an automated email from the ASF dual-hosted git repository.
xxyu pushed a commit to branch kylin5_beta
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit d7950dfd7b9f3d80c0b8e15f669871ea363e57ba
Author: Qian Xia <la...@gmail.com>
AuthorDate: Thu Jul 20 17:08:06 2023 +0800
KYLIN-5661 fix del cc from fact table issue
---
.../studio/StudioModel/ModelEdit/model.js | 22 +++++++++++++++-------
.../ModelList/ConfirmSegment/ConfirmSegment.vue | 11 +++++------
.../StudioModel/ModelList/ConfirmSegment/store.js | 6 ++----
3 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/kystudio/src/components/studio/StudioModel/ModelEdit/model.js b/kystudio/src/components/studio/StudioModel/ModelEdit/model.js
index 42837e30a4..7d111e1f34 100644
--- a/kystudio/src/components/studio/StudioModel/ModelEdit/model.js
+++ b/kystudio/src/components/studio/StudioModel/ModelEdit/model.js
@@ -943,11 +943,13 @@ class NModel extends Schama {
_updateCCToNewFactTable () {
let factTable = this.getFactTable()
if (factTable) {
- this._mount.computed_columns.forEach((x) => {
- x.table_guid = factTable.guid
- x.tableIdentity = factTable.name
- x.tableAlias = factTable.tableAlias
+ this._mount.computed_columns.forEach((cc) => {
+ cc.table_guid = factTable.guid
+ cc.tableIdentity = factTable.name
+ cc.tableAlias = factTable.tableAlias
+ factTable.all_columns.push({...cc, name: cc.columnName, column: cc.columnName, is_computed_column: true})
})
+ factTable.filterColumns()
}
}
// 移除和某个表相关的partition信息
@@ -960,9 +962,11 @@ class NModel extends Schama {
}
_delCCInTableAllColumns (t, column) {
const index = t.all_columns.findIndex(it => it.column === column)
- t.all_columns.splice(index, 1)
- t.columnCurrentPage = 1
- t.filterColumns()
+ if (index !== -1) {
+ t.all_columns.splice(index, 1)
+ t.columnCurrentPage = 1
+ t.filterColumns()
+ }
// this.$set(this._mount.tables, t.guid, t)
}
changeTableType (t) {
@@ -978,6 +982,10 @@ class NModel extends Schama {
// this._arrangeLinks()
} else if (t.name === this.fact_table) {
this.fact_table = '' // fact 改为 lookup 需要将它设置为空
+ // 删除 all_columns 里相关 cc
+ this._mount.computed_columns.forEach((c) => {
+ this._delCCInTableAllColumns(t, c.columnName)
+ })
}
// 删除对应的partition
this._delTableRelatedPartitionInfo(t)
diff --git a/kystudio/src/components/studio/StudioModel/ModelList/ConfirmSegment/ConfirmSegment.vue b/kystudio/src/components/studio/StudioModel/ModelList/ConfirmSegment/ConfirmSegment.vue
index 7578ae92f5..730945925a 100644
--- a/kystudio/src/components/studio/StudioModel/ModelList/ConfirmSegment/ConfirmSegment.vue
+++ b/kystudio/src/components/studio/StudioModel/ModelList/ConfirmSegment/ConfirmSegment.vue
@@ -114,7 +114,6 @@ vuex.registerModule(['modals', 'ConfirmSegment'], store)
indexes: state => state.indexes,
isRemoveIndex: state => state.isRemoveIndex,
submitText: state => state.submitText,
- isHybridBatch: state => state.isHybridBatch,
model: state => state.model,
callback: state => state.callback
})
@@ -166,7 +165,7 @@ export default class ConfirmSegmentModal extends Vue {
try {
const { sortBy, reverse } = this.filter
const projectName = this.currentSelectedProject
- const modelName = this.isHybridBatch ? this.model.batch_id : this.model.uuid
+ const modelName = this.model.uuid
// const startTime = startDate && transToUTCMs(startDate)
// const endTime = endDate && transToUTCMs(endDate)
const data = { projectName, modelName, sortBy, reverse, ...this.pagination }
@@ -273,7 +272,7 @@ export default class ConfirmSegmentModal extends Vue {
// 有值说明是刷新segment list
if (this.refrashWarningSegment) {
const segmentIds = this.selectedSegmentIds
- const modelId = this.isHybridBatch ? this.model.batch_id : this.model.uuid
+ const modelId = this.model.uuid
const projectName = this.currentSelectedProject
const isSubmit = await this.refreshSegments({ projectName, modelId, segmentIds })
if (isSubmit) {
@@ -283,7 +282,7 @@ export default class ConfirmSegmentModal extends Vue {
} else {
if (this.indexes.length > 0 && !this.isRemoveIndex) {
const res = await this.complementBatchIndex({
- modelId: this.isHybridBatch ? this.model.batch_id : this.model.uuid,
+ modelId: this.model.uuid,
data: {
project: this.currentSelectedProject,
segment_ids: this.selectedSegmentIds,
@@ -299,7 +298,7 @@ export default class ConfirmSegmentModal extends Vue {
}
} else if (this.indexes.length > 0 && this.isRemoveIndex) {
await this.deleteBatchIndex({
- modelId: this.isHybridBatch ? this.model.batch_id : this.model.uuid,
+ modelId: this.model.uuid,
data: {
project: this.currentSelectedProject,
segment_ids: this.selectedSegmentIds,
@@ -309,7 +308,7 @@ export default class ConfirmSegmentModal extends Vue {
this.$message({ type: 'success', message: this.$t('kylinLang.common.delSuccess') })
} else {
const res = await this.complementAllIndex({
- modelId: this.isHybridBatch ? this.model.batch_id : this.model.uuid,
+ modelId: this.model.uuid,
data: {
project: this.currentSelectedProject,
segment_ids: this.selectedSegmentIds,
diff --git a/kystudio/src/components/studio/StudioModel/ModelList/ConfirmSegment/store.js b/kystudio/src/components/studio/StudioModel/ModelList/ConfirmSegment/store.js
index 3e547e24b5..93a8ca02a2 100644
--- a/kystudio/src/components/studio/StudioModel/ModelList/ConfirmSegment/store.js
+++ b/kystudio/src/components/studio/StudioModel/ModelList/ConfirmSegment/store.js
@@ -15,7 +15,6 @@ const initialState = JSON.stringify({
isRemoveIndex: false,
submitText: '',
model: null,
- isHybridBatch: false, // 标识是否是融合数据模型下的批数据模型
callback: null
})
export default {
@@ -38,7 +37,6 @@ export default {
state.indexes = payload.indexes
state.isRemoveIndex = payload.isRemoveIndex
state.submitText = payload.submitText
- state.isHybridBatch = payload.isHybridBatch || false
state.model = payload.model
},
[types.RESET_MODAL_FORM]: state => {
@@ -46,9 +44,9 @@ export default {
}
},
actions: {
- [types.CALL_MODAL] ({ commit }, { title, subTitle, refrashWarningSegment, indexes, isRemoveIndex, submitText, isHybridBatch = false, model }) {
+ [types.CALL_MODAL] ({ commit }, { title, subTitle, refrashWarningSegment, indexes, isRemoveIndex, submitText, model }) {
return new Promise(resolve => {
- commit(types.SET_MODAL_FORM, { callback: resolve, title: title, subTitle: subTitle, refrashWarningSegment: refrashWarningSegment, indexes: indexes, isRemoveIndex: isRemoveIndex, submitText: submitText, isHybridBatch: isHybridBatch, model: model })
+ commit(types.SET_MODAL_FORM, { callback: resolve, title: title, subTitle: subTitle, refrashWarningSegment: refrashWarningSegment, indexes: indexes, isRemoveIndex: isRemoveIndex, submitText: submitText, model: model })
commit(types.SHOW_MODAL)
})
}