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/04/23 06:00:58 UTC
[kylin] 17/22: KYLIN-5498 Fixed a bug where click Save and build btn and not pull up a build-task after changing the multil partition model to a full model
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 b61ce536d05446a230b735472027511f463b6d7a
Author: huangsheng <hu...@163.com>
AuthorDate: Wed Feb 1 15:56:33 2023 +0800
KYLIN-5498 Fixed a bug where click Save and build btn and not pull up a build-task after changing the multil partition model to a full model
---
.../kylin/rest/service/ModelSemanticHelper.java | 36 ++++++++++++++--------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/src/modeling-service/src/main/java/org/apache/kylin/rest/service/ModelSemanticHelper.java b/src/modeling-service/src/main/java/org/apache/kylin/rest/service/ModelSemanticHelper.java
index 54190bcd77..725d3994f6 100644
--- a/src/modeling-service/src/main/java/org/apache/kylin/rest/service/ModelSemanticHelper.java
+++ b/src/modeling-service/src/main/java/org/apache/kylin/rest/service/ModelSemanticHelper.java
@@ -58,6 +58,7 @@ import org.apache.kylin.job.model.JobParam;
import org.apache.kylin.metadata.cube.cuboid.NAggregationGroup;
import org.apache.kylin.metadata.cube.model.IndexPlan;
import org.apache.kylin.metadata.cube.model.LayoutEntity;
+import org.apache.kylin.metadata.cube.model.NDataflow;
import org.apache.kylin.metadata.cube.model.NDataflowManager;
import org.apache.kylin.metadata.cube.model.NIndexPlanManager;
import org.apache.kylin.metadata.cube.model.RuleBasedIndex;
@@ -966,6 +967,22 @@ public class ModelSemanticHelper extends BasicService {
return SourceFactory.getSource(tableDesc).getSegmentRange(start, end);
}
+
+ private void handleDatePartitionColumn(NDataModel newModel, NDataflowManager dataflowManager, NDataflow df,
+ String modelId, String project, String start, String end) {
+ // from having partition to no partition
+ if (newModel.getPartitionDesc() == null) {
+ dataflowManager.fillDfManually(df,
+ Lists.newArrayList(SegmentRange.TimePartitionedSegmentRange.createInfinite()));
+ return;
+ }
+ // change partition column and from no partition to having partition
+ if (StringUtils.isNotEmpty(start) && StringUtils.isNotEmpty(end)) {
+ dataflowManager.fillDfManually(df,
+ Lists.newArrayList(getSegmentRangeByModel(project, modelId, start, end)));
+ }
+ }
+
private void handleReloadData(NDataModel newModel, NDataModel oriModel, String project, String start, String end) {
val config = KylinConfig.getInstanceFromEnv();
val dataflowManager = NDataflowManager.getInstance(config, project);
@@ -981,27 +998,22 @@ public class ModelSemanticHelper extends BasicService {
String modelId = newModel.getUuid();
NDataModelManager modelManager = NDataModelManager.getInstance(config, project);
if (newModel.isMultiPartitionModel() || oriModel.isMultiPartitionModel()) {
- boolean isPartitionChange = !isMultiPartitionDescSame(oriModel.getMultiPartitionDesc(),
+ boolean isMultiPartitionChange = !isMultiPartitionDescSame(oriModel.getMultiPartitionDesc(),
newModel.getMultiPartitionDesc())
|| !Objects.equals(oriModel.getPartitionDesc(), newModel.getPartitionDesc());
- if (isPartitionChange && newModel.isMultiPartitionModel()) {
+ if (isMultiPartitionChange && newModel.isMultiPartitionModel()) {
modelManager.updateDataModel(modelId, copyForWrite -> {
copyForWrite.setMultiPartitionDesc(
new MultiPartitionDesc(newModel.getMultiPartitionDesc().getColumns()));
});
}
+ // Case where the date partition column of the multi partition model has also been changed
+ if (!Objects.equals(oriModel.getPartitionDesc(), newModel.getPartitionDesc())) {
+ handleDatePartitionColumn(newModel, dataflowManager, df, modelId, project, start, end);
+ }
} else {
if (!Objects.equals(oriModel.getPartitionDesc(), newModel.getPartitionDesc())) {
-
- // from having partition to no partition
- if (newModel.getPartitionDesc() == null) {
- dataflowManager.fillDfManually(df,
- Lists.newArrayList(SegmentRange.TimePartitionedSegmentRange.createInfinite()));
- // change partition column and from no partition to having partition
- } else if (StringUtils.isNotEmpty(start) && StringUtils.isNotEmpty(end)) {
- dataflowManager.fillDfManually(df,
- Lists.newArrayList(getSegmentRangeByModel(project, modelId, start, end)));
- }
+ handleDatePartitionColumn(newModel, dataflowManager, df, modelId, project, start, end);
} else {
List<SegmentRange> segmentRanges = Lists.newArrayList();
segments.forEach(segment -> segmentRanges.add(segment.getSegRange()));