fix(headless): 解决数据集维度数据类型映射空指针异常
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

- 添加对 dataTypeMap 的 containsKey 检查避免空指针异常
- 修复维度数据类型映射逻辑中的潜在运行时错误
- 确保在模型ID不存在时跳过数据类型映射操作
This commit is contained in:
jerryjzhang
2026-06-20 17:43:12 +08:00
parent 6d41ce4c5b
commit 0868850edd
2 changed files with 6 additions and 3 deletions

View File

@@ -55,7 +55,8 @@ public class HanlpDictMatchStrategy extends SingleMatchStrategy<HanlpMapResult>
// higher-similarity records are inserted first and survive LinkedHashSet dedup
hanlpMapResults = hanlpMapResults.stream()
.sorted(Comparator.comparingDouble(HanlpMapResult::getSimilarity).reversed()
.thenComparing((a, b) -> Integer.compare(b.getName().length(), a.getName().length())))
.thenComparing((a, b) -> Integer.compare(b.getName().length(),
a.getName().length())))
.collect(Collectors.toCollection(LinkedHashSet::new));
// step4. filter by similarity

View File

@@ -123,8 +123,10 @@ public class DataSetSchemaBuilder {
dimToAdd.getExtInfo().put(DimensionConstants.DIMENSION_DATA_TYPE,
dim.getDataType());
} else {
dimToAdd.getExtInfo().put(DimensionConstants.DIMENSION_DATA_TYPE,
dataTypeMap.get(dim.getModelId()).get(dim.getBizName()));
if (dataTypeMap.containsKey(dim.getModelId())) {
dimToAdd.getExtInfo().put(DimensionConstants.DIMENSION_DATA_TYPE,
dataTypeMap.get(dim.getModelId()).get(dim.getBizName()));
}
}
if (dim.isTimeDimension()) {
String timeFormat =