mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-06-25 22:29:22 +08:00
feat(dimension): 添加维度数据类型支持
- 在Dimension类中新增dataType字段 - 更新Dimension构造函数以支持dataType参数 - 在DimensionConverter中添加dataType转换逻辑 - 在ModelConverter中集成DataTypeEnums转换 - 支持从语义列到维度的数据类型映射
This commit is contained in:
@@ -21,6 +21,8 @@ public class Dimension {
|
||||
|
||||
private String dateFormat = Constants.DAY_FORMAT;
|
||||
|
||||
private String dataType;
|
||||
|
||||
private DimensionTimeTypeParams typeParams;
|
||||
|
||||
private Integer isCreateDimension = 0;
|
||||
@@ -37,13 +39,14 @@ public class Dimension {
|
||||
this.expr = bizName;
|
||||
}
|
||||
|
||||
public Dimension(String name, String bizName, String expr, DimensionType type,
|
||||
public Dimension(String name, String bizName, String expr, DimensionType type, String dataType,
|
||||
Integer isCreateDimension) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.isCreateDimension = isCreateDimension;
|
||||
this.bizName = bizName;
|
||||
this.expr = expr;
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public Dimension(String name, String bizName, DimensionType type, Integer isCreateDimension,
|
||||
|
||||
@@ -73,6 +73,9 @@ public class DimensionConverter {
|
||||
if (dimensionReq.getTypeParams() != null) {
|
||||
dimensionDO.setTypeParams(JSONObject.toJSONString(dimensionReq.getTypeParams()));
|
||||
}
|
||||
if (dimensionReq.getDataType() != null) {
|
||||
dimensionDO.setDataType(dimensionReq.getDataType().getType());
|
||||
}
|
||||
dimensionDO.setStatus(StatusEnum.ONLINE.getCode());
|
||||
return dimensionDO;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.common.pojo.DimensionConstants;
|
||||
import com.tencent.supersonic.common.pojo.User;
|
||||
import com.tencent.supersonic.common.pojo.enums.DataTypeEnums;
|
||||
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
|
||||
import com.tencent.supersonic.common.util.BeanMapper;
|
||||
import com.tencent.supersonic.common.util.JsonUtil;
|
||||
@@ -109,6 +110,7 @@ public class ModelConverter {
|
||||
dimensionReq.setModelId(modelDO.getId());
|
||||
dimensionReq.setExpr(dim.getExpr());
|
||||
dimensionReq.setType(dim.getType().name());
|
||||
dimensionReq.setDataType(DataTypeEnums.of(dim.getDataType()));
|
||||
dimensionReq
|
||||
.setDescription(Objects.isNull(dim.getDescription()) ? dimensionReq.getDescription()
|
||||
: dim.getDescription());
|
||||
@@ -193,7 +195,8 @@ public class ModelConverter {
|
||||
if (optional.isEmpty()) {
|
||||
Dimension dim = new Dimension(semanticColumn.getName(),
|
||||
semanticColumn.getColumnName(), semanticColumn.getExpr(),
|
||||
DimensionType.valueOf(semanticColumn.getFiledType().name()), 1);
|
||||
DimensionType.valueOf(semanticColumn.getFiledType().name()),
|
||||
semanticColumn.getDataType(), 1);
|
||||
modelDetail.getDimensions().add(dim);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user