feat(dimension): 添加维度数据类型支持
Some checks failed
supersonic CentOS CI / build (21) (push) Has been cancelled
supersonic mac CI / build (21) (push) Has been cancelled
supersonic ubuntu CI / build (21) (push) Has been cancelled
supersonic windows CI / build (21) (push) Has been cancelled

- 在Dimension类中新增dataType字段
- 更新Dimension构造函数以支持dataType参数
- 在DimensionConverter中添加dataType转换逻辑
- 在ModelConverter中集成DataTypeEnums转换
- 支持从语义列到维度的数据类型映射
This commit is contained in:
jerryjzhang
2026-05-22 17:45:46 +08:00
parent 9f2262c97b
commit 5b77b39c60
3 changed files with 11 additions and 2 deletions

View File

@@ -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,

View File

@@ -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;
}

View File

@@ -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);
}
}