mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 14:36:47 +00:00
(fix)(chat) Fix the null pointer issue in fieldNameToDateFormat. (#1587)
This commit is contained in:
@@ -90,6 +90,6 @@ public class SchemaElement implements Serializable {
|
|||||||
if (StringUtils.isNotBlank(timeFormat) && containsPartitionTime()) {
|
if (StringUtils.isNotBlank(timeFormat) && containsPartitionTime()) {
|
||||||
return timeFormat;
|
return timeFormat;
|
||||||
}
|
}
|
||||||
return null;
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -164,7 +165,9 @@ public class LLMRequestService {
|
|||||||
Map<String, String> fieldNameToDateFormat = semanticSchema.getDimensions().stream()
|
Map<String, String> fieldNameToDateFormat = semanticSchema.getDimensions().stream()
|
||||||
.filter(dimension -> StringUtils.isNotBlank(dimension.getTimeFormat()))
|
.filter(dimension -> StringUtils.isNotBlank(dimension.getTimeFormat()))
|
||||||
.collect(Collectors.toMap(
|
.collect(Collectors.toMap(
|
||||||
SchemaElement::getName, SchemaElement::getPartitionTimeFormat, (k1, k2) -> k1)
|
SchemaElement::getName,
|
||||||
|
value -> Optional.ofNullable(value.getPartitionTimeFormat()).orElse(""),
|
||||||
|
(k1, k2) -> k1)
|
||||||
);
|
);
|
||||||
|
|
||||||
// 构建额外信息字符串
|
// 构建额外信息字符串
|
||||||
@@ -175,7 +178,7 @@ public class LLMRequestService {
|
|||||||
extraInfoSb.append(String.format("%s的计量单位是%s; ", fieldName, "小数"));
|
extraInfoSb.append(String.format("%s的计量单位是%s; ", fieldName, "小数"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 构建分区日期格式化信息
|
// 构建日期格式化信息
|
||||||
for (String fieldName : fieldNameList) {
|
for (String fieldName : fieldNameList) {
|
||||||
String timeFormat = fieldNameToDateFormat.get(fieldName);
|
String timeFormat = fieldNameToDateFormat.get(fieldName);
|
||||||
if (StringUtils.isNotBlank(timeFormat)) {
|
if (StringUtils.isNotBlank(timeFormat)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user