mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-06-26 06:39:20 +08:00
fix(headless): 解决数据集维度数据类型映射空指针异常
- 添加对 dataTypeMap 的 containsKey 检查避免空指针异常 - 修复维度数据类型映射逻辑中的潜在运行时错误 - 确保在模型ID不存在时跳过数据类型映射操作
This commit is contained in:
@@ -55,7 +55,8 @@ public class HanlpDictMatchStrategy extends SingleMatchStrategy<HanlpMapResult>
|
|||||||
// higher-similarity records are inserted first and survive LinkedHashSet dedup
|
// higher-similarity records are inserted first and survive LinkedHashSet dedup
|
||||||
hanlpMapResults = hanlpMapResults.stream()
|
hanlpMapResults = hanlpMapResults.stream()
|
||||||
.sorted(Comparator.comparingDouble(HanlpMapResult::getSimilarity).reversed()
|
.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));
|
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||||
|
|
||||||
// step4. filter by similarity
|
// step4. filter by similarity
|
||||||
|
|||||||
@@ -123,8 +123,10 @@ public class DataSetSchemaBuilder {
|
|||||||
dimToAdd.getExtInfo().put(DimensionConstants.DIMENSION_DATA_TYPE,
|
dimToAdd.getExtInfo().put(DimensionConstants.DIMENSION_DATA_TYPE,
|
||||||
dim.getDataType());
|
dim.getDataType());
|
||||||
} else {
|
} else {
|
||||||
dimToAdd.getExtInfo().put(DimensionConstants.DIMENSION_DATA_TYPE,
|
if (dataTypeMap.containsKey(dim.getModelId())) {
|
||||||
dataTypeMap.get(dim.getModelId()).get(dim.getBizName()));
|
dimToAdd.getExtInfo().put(DimensionConstants.DIMENSION_DATA_TYPE,
|
||||||
|
dataTypeMap.get(dim.getModelId()).get(dim.getBizName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (dim.isTimeDimension()) {
|
if (dim.isTimeDimension()) {
|
||||||
String timeFormat =
|
String timeFormat =
|
||||||
|
|||||||
Reference in New Issue
Block a user